Using Composer Globally

_08 Feb 2013


Update (10/29/2013): You can now install packages globally! It looks like this: composer global require package-name:version

Package managers are great. One of the great things about npm -g or gem is the ability to expose bin scripts to provide utilities for developers.

In Composer, currently there is no support for this.

I wrote a little script that will set up a Composer location to be used globally. It’s super easy to use:

$ curl | sh
Be sure to add $HOME/.composer/bin to your PATH

Require a package:

$ cd ~/.composer && composer require package-name:version

Here is the script source: