Composer libraries as global Linux commands

Composer global commands

There is a neat feature in Composer that allows to run libraries as Linux commands, which can speed up your development and maintenance of your projects. It also gives you more flexibility and can automate development process.

Example usage

For example you could create new projects in Laravel by running: laravel new project-name in your command line interface.

How to do it on Linux

You can navigate to /home/{user}/.composer/vendor/bin and see folders such as /laravel or /spark. After running bellow command in the terminal you will be able to run those commands.

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

Command may differ between Linux distributions but the idea is to add this bin folder path to global This way you can run installed libraries as usual commands: