composer/composer — pull request #3130 by weaverryan (2014-07-17 02:06:26+00:00)
Title: New command to install a global composer

Hi guys!

See #3125. This introduces a new command - `add-global-cmd` - which attempts to move the PHAR file that's currently being executed into the bin directory where the php executable lives. The plan is to then (in a different PR, on the proper repository) modify the `https://getcomposer.org/installer` script to call this command on the brand new `composer.phar` file it just downloaded.

With this, the original `composer.phar` file remains in-tact, meaning that people can easily use "local" composer.phar installs just like before.

To summarize, after this is merged and the `installer` script is modified (not done here), the flow would be:

1. Run `curl -sS https://getcomposer.org/installer | php` (probably with a new option, like `--global` that triggers this new behavior, to protect BC)

2. The `composer.phar` file is downloaded into the current directory, like always

3. This new command asks the user if they want a global `composer` command also installed

4. If yes, the `composer.phar` file is copied into a global path. This requires sudo - so most users will be asked for their password

5. After finishing, the installer script will summarize what happened and how to run composer (e.g. "Run `composer` or `php composer.phar` to use Composer").

Two questions are:

A) Do we see any issues or improvements with this "flow"?

B) Do we see any technical/security issues, especially with running sudo and trying to figure out *where* to place the `composer` executable.

Thanks!