GithubHelp home page GithubHelp logo

challenge48h-2023's Introduction

Evan Hoizey Logo

+

Laravel Logo

Global Laravel Template

This repo tends to be updated with features I use and want to default in my future projects.


Quick Setup

Everything is set to be installed in a few steps. The point of the template is to be quick to setup and easy to use.

Following these steps should get everything working with no errors :

  1. Make sure your terminal is in a local server environment such as MAMP, XAMPP or a Docker container. This step is essential to have the live reload working as PHP files won't get monitored in a basic browser preview.
  2. Clone the repository using git with git clone [link]
  3. Install all the dependencies with composer i or composer install
  4. Install npm packages with npm i or npm install

Now, the installations should have gone well. If not, check if your PHP version is >= 8.1 on your environment. (I had to update my MAMP once to get the right versions so think about this before changing anything inside the template)


Starting Local Server

Try and start the local server with npm run watch.

  • If not working, try reinstalling Laravel-mix with : npm install laravel-mix --save-dev

  • Check if the scripts are well defined, here is the package.json part as it should be :

"scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
},

If it's not like this, then... change it to that and try again.

For more information, I strongly suggest checking - Laravel Mix documentation.


Going further

Changing environment variables could get you lost at first but is a strong tool to get further in your automations.

Head into .env at the root of the template and play with the vars.

Some commands could help as you use a lot of artisan, like : alias phpa='php artisan' and replace php artisan [...] with phpa [...].

Custom Local URL

You could change APP_URL=localhost to whatever you want but will need some toying. As a mac user, I have to edit my hosts settings to allow a new local url redirection. Here is the technique : open sudo nano /etc/hosts and add the following lines within the Hosts Database section :

0.0.0.0 app.test
0.0.0.0 www.app.test

Note : Both URLs are purely arbitrary and could be anything.

Configure Your Database

Here, you won't have much more to do than defaulting env variables to your DB configuration.

Using MAMP or XAMPP, you should be able to connect to your phpmyadmin database, check your software's documentation for further reading.

Using Docker, you probably already created your container by yourself and thus added your own DB config. If not, I advise that you check everything on Docker's documentation as to how to setup a database with Docker.


Resolve Problems

php artisan optimize

&

php artisan route:clear

These two commands will be important when you update your routes (whether in your web.php or in a call like config('app.name') that points on changing app's title)


Relative documentations :


Laravel License

The Laravel framework is open-sourced software licensed under the MIT license.

challenge48h-2023's People

Contributors

evanhzg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.