Laravel 5 is one of the most popular PHP framework, meanwhile the documentation is not as clear as we should expect. When I was trying to follow the documentation guide for installing this framework on windows, I was getting some unexpected error. In previous article about “How to install laravel 5 on windows“, we have learned how to install laravel 5 using composer. So in this article we are going to learn, how to install laravel 5 using laravel installer.
1. Installing composer.
Laravel need Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine. If you don’t know how to install composer, take a look at previous article install Laravel 5 on Windows.
2. Install laravel installer.
Once you have installed composer, open command prompt by pressing shift and right clicking in directory you want to install laravel installer.
Now run the following command to install laravel installer.
composer global require "laravel/installer=~1.1"
3. Path environment variable.
Here is the important part. The official documentation says :
Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable can be located by your system.
Now, how to place the ~/.composer/vender/bin directory in your PATH ?
Here is the easiest way to do it. Update the PATH environment variable via e.g. command prompt with admin privileges:
setx /M path "%path%;%appdata%\Composer\vendor\bin"
%appdata% is added, so you don’t have to worry about adding your computer name. It will add dynamically.
4. Create a fresh Laravel Installation:
Now you should be able to run laravel commands in the command prompt.
To create a fresh laravel installation using laravel installer, open a command prompt in the directory of choice and enter:
laravel new project-name
If everything went right, you should see the following message:
Crafting application... Application ready! Build something amazing.
I hope it has been informative for you and if you have any question feel free to ask bellow in comment. 🙂