In the installation documentation for Laravel they explain that in order to globally add the Laravel installer you must place the ~/.composer/vendor/bin directory in your PATH but they don't explain how to do this. So here's how to set the PATH on your machine:

For Mac/Linux

Add the following to your .bash_profile, .bashrc, or .zshrc file depending on which shell you are using:

export PATH=∼/.composer/vendor/bin:$PATH

For PC

Make sure you have admin priveleges and, you will have to use one of the following 2 commands:

setx /M path “%path%;%appdata%Composer\vendor\bin”
set PATH=%PATH%;%USERPROFILE%AppDataRoamingComposer\vendor\bin

Ok, here's what's happening. When you globally installed the laravel installer it got added to a certain location on your machine, so when you set the PATH, you are essentially making your machine aware of this directory, so when you run the command: laravel new project, it finds the laravel executable from the composer/bin/directory.

Hope this helps :) Happy Laravel programming!


Login

or Sign Up

Sign Up

or Login