Laravel is a PHP framework so we need to start with a L(W)AMP server of some sort. We recommend PHP 7 but from PHP 5.6 will do.
Laravel is easiest to install with Composer.
Once Composer is installed according to their instructions, we can use it to install Laravel. There are different methods of installing Laravel but I prefer installing it as a global package on the system. To do this, on the command line type:
composer global require “laravel/installer”
and then press enter.
You’ll now need to add “$HOME/.composer/vendor/bin” to your system path so that your OS knows where to find Laravel. For Ubuntu we can do this in ~/.bashrc by adding the line:
This adds composer to your system path so that from the command line you can now type Laravel to see their help menus.
To create a fresh Laravel site all you need to do now is open a command line and cd to your web directory. So for me on Ubuntu:
and then I run laravel like this:
laravel new my-cool-site
This will create the directory call my-cool-site with a new Laravel installation.
You should now use artisan to set the encryption key for the site you may get an error.
cd into your new directory:
php artisan key:generate
You can now type:
php artisan serve
and copy the link it provides into a browser to see your new installation in action!
John McMurray is a freelance PHP developer. Experienced in PHP, Laravel and WordPress he can code anything you need.
Based in Plettenberg Bay, Western Cape I am available for PHP, Laravel or WordPress freelance jobs in Johannesburg, Pretoria, Cape Town, Port Elizabeth. I also often do remote PHP freelance work all over South Africa and the rest of the world.