Laravel is a very popular open source PHP framework aimed at easy development of applications. If you are already Setup your local environment with Apache2 , php, mySql and phpmyadmin and looking for a new PHP framework to try, you should give Laravel a try.
To install Laravel, we need to install Composer first. It is a tool for dependency management in PHP that allows you to package all the required libraries associated with a package as one. To install Laravel and all its dependencies, Composer is required. It will download and install everything that is required to run Laravel framework. To install Composer, issue the following commands.
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
If you don’t have curl , then install it by typing this command,
sudo apt-get install curl
when you installed composer pretty sure you use $sudo …. because of that the folder was created by the root which you do not have permission even if you have admin privilege.
After install composer you need to give composer-cache file permissions by this command,
sudo chown -R $USER $HOME/.composer
Now we can run composer from anywhere.
To install Laravel, move to the public html directory on your system. Since we are on Ubuntu / Linux mint , Goto the /var/www/html directory. Type the following command and hit enter ,
composer create-project –prefer-dist laravel/laravel explore
The above command will create a your-project directory with laravel installation in it. Composer uses git to download and install all the packages and modules that Laravel requires for functioning.
Your Laravel installation is now complete. Now goto /var/www/html directory , open your terminal and paste this command on terminal and hit enter.
php artisan serve
Then open your favorite browser and Visit http://localhost:8000 to access your Laravel installation.
If successful you should see the following screen.