February 7, 2015

Installing PHP Composer globally on Mac & Linux

Composer is a dependency manager for PHP. PEAR used to be the go-to tool for managing PHP dependencies quite some time ago, but it was always cumbersome, and not much fun to use. Composer makes it very easy!

Installing Composer is easy on Mac or Linux:
curl -sS https://getcomposer.org/installer | php

If you want to run it globally, simply move and rename the downloaded .phar file:
mv composer.phar /usr/local/bin/composer

It might even be possible to set it all up in a single command, though I cannot test it right now:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

You can now run the composer command from anywhere in your shell.

composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.0-dev

No comments :

Post a Comment