Skip to content

Commit

Permalink
Added an alternative section for installing Composer manually
Browse files Browse the repository at this point in the history
  • Loading branch information
wilmoore committed Jul 9, 2012
1 parent d366467 commit 1c2370b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion _includes/dependency-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,32 @@ There are already a lot of PHP libraries that are compatible with Composer, read

### How to Install Composer

You can install Composer locally (in your current working directory) or globally (e.g. /usr/local/bin). Let's assume you want to install Composer locally. From your project's root directory:
You can install Composer locally (in your current working directory; though this is no longer recommended) or globally (e.g. /usr/local/bin). Let's assume you want to install Composer locally. From your project's root directory:

> curl -s http://getcomposer.org/installer | php

This will download `composer.phar` (a PHP binary archive). You can run this with `php` to manage your project dependencies. <strong>Please Note:</strong> If you pipe downloaded code directly into an interpreter, please read the code online first to confirm it is safe.

### How to Install Composer (manually)

Manually installing composer is an advanced technique; however, there are various reasons why a developer might prefer this method vs. using the interactive installation routine. The interactive installation checks your PHP installation to ensure that:

- a sufficient version of PHP is being used
- `.phar` files can be executed correctly
- certain directory permissions are sufficient
- certain problematic extensions are not loaded
- certain `php.ini` settings are set

Since a manual installation performs none of these checks, you have to decide whether the trade-off is worth it for you. As such, below is how to obtain Composer manually:

> curl -s http://getcomposer.org/composer.phar -o $HOME/local/bin/composer ; chmod +x $HOME/local/bin/composer

`$HOME/local/bin` (or a directory of your choice) should be in your `$PATH` environment variable. This will result in a `composer` command being available.

When you come across documentation that states to run Composer as `php composer.phar install`, you can substitute that with:

> composer install

### How to Define and Install Dependencies

First, create a `composer.json` file in the same directory as `composer.phar`. Here's an example that lists [Twig][2] as a project dependency.
Expand Down

0 comments on commit 1c2370b

Please sign in to comment.