$PATH - How to Add Composer To Linux Ubuntu Environment


Adding Composer to $PATH Environment in Ubuntu

If you need to add composer to your $PATH all you have to do is add the ‘bin’ directory to the PATH environment through the ~/.bashrc configuration. To do this, you need to edit the ~/.bashrc file with this command using nano or any other text editor, for example:

nano ~/.bashrc

And add the following code line at the end of the file.

export PATH="$HOME/.config/composer/vendor/bin:$PATH"

Save and reload your .bashrc configuration using the cource command.

source ~/.bashrc

Echo $PATH to confirm. It will output your “Bin” directory path for the Composer package.

echo $PATH

Now you have added the 'bin' directory to the compoer package in your $PATH environment.

This is very helpful if you are using laravel for example.