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:
Add the following to your .bash_profile, .bashrc, or .zshrc file depending on which shell you are using:
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!