Setting up a Laravel project

To have Laravel, we need to install Composer, PHP package manager into our machine. Then, install Laravel globally with composer global require laravel/installer. The binary for it should reside in either $HOME/.composer/vendor/bin/ or $XDG_CONFIG_HOME/composer/vendor/bin/, which you should add it to the environment PATH.

As the binary is ready in use, create a Laravel project with the command laravel new {project-name}. This will create a directory structure. If there is a need for authentication, you could install the package laravel/ui for ui:auth locally (to the project) with composer require laravel/ui. Upon the project creation, it will provide an executable PHP script artisan. To activate the module ui:auth, you need to run php artisan ui:auth.

Now, we can set up the project by running npm install && npm run dev to install various JavaScript dependencies (this requires NodeJS and NPM). Furthermore, create a file name database.{db-extention} inside the directory database according to the database you are going to use. Remember to check you have the required PHP module(s) for the database, and it has been activated in /etc/php/php.ini.

#php #web