Skip to content

Instantly share code, notes, and snippets.

@tamagokun
Created June 7, 2012 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamagokun/2890866 to your computer and use it in GitHub Desktop.
Save tamagokun/2890866 to your computer and use it in GitHub Desktop.
Global specification for Composer

What

This is a proposed feature for Composer in which you would be able to add a --global option to manipulate installed packages at a system-wide / user-wide level.

This should not be used for autoloading, but rather just for running any binaries.

Why

Some projects provide utilities to be run via the command line. Like other package managers, these packages should be able to be installed at a global level so the commands can be run as long as you have the bin directory in your PATH.

Folder

Since Composer already uses ~/.composer for caching, this should be the default folder for --global. There needs to be a way to specify an alternative location i.e. /usr/local/lib/composer

How

The desired folder would contain a composer.json that would look like:

{
    "config": {
        "vendor-dir": "vendor",
        "bin-dir": "bin"
    }
}
  • Using composer (add|install) package/composer (remove|uninstall) package would modify the require hash of this file and then perform the appropriate action.
  • Users could optionally specify a version when installing: --version option or @version suffix
  • Packages would be installed under the global vendor directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment