Composer global verwenden

In der Dokumentation zu Composer wird erläutert, wie man global auf composer.phar zugreifen kann, ohne permanent php composer.phar ins Terminal eingeben zu müssen:

[…]

You can place the Composer PHAR anywhere you wish. If you put it in a directory that is part of your PATH, you can access it globally. On unix systems you can even make it executable and invoke it without directly using the php interpreter.

After running the installer following the Download page instructions you can run this to move composer.phar to a directory that is in your path:

mv composer.phar /usr/local/bin/composer

Note: If the above fails due to permissions, you may need to run it again with sudo.

Note: On some versions of OSX the /usr directory does not exist by default. If you receive the error “/usr/local/bin/composer: No such file or directory” then you must create the directory manually before proceeding: mkdir -p /usr/local/bin.

Note: For information on changing your PATH, please read the Wikipedia article and/or use Google.

Now just run composer in order to run Composer instead of php composer.phar.

Leave a Reply

Your email address will not be published. Required fields are marked *