Composer

Composer is a dependency manager for PHP libraries. In addition, it can be used to manage the installation of MediaWiki extensions (available since MediaWiki 1.22). Starting with MediaWiki 1.25, MediaWiki core's external library dependencies are being managed with Composer.

Installing Composer
There are multiple ways to install Composer: To grab the latest snapshot: wget https://getcomposer.org/composer.phar

That downloads a snapshot of the current master and will expire in 30 days. There are also phars for the alpha "releases" such as 1.0.0-alpha.

For users on OSX, you can use Homebrew to install composer: brew tap josegonzalez/homebrew-php && brew install composer

If that doesn't work, or you do not have Homebrew installed, you can try: php -r "readfile('https :// getcomposer.org/installer');" | php

Jenkins and the extension distributor use the copy of composer contained in the "integration/composer" git repo.

Once composer is installed, you can run commands via the downloaded phar: php composer.phar someCommand

You may want to move the phar into your path so it can be used as a normal executable: composer someCommand

Usage in MediaWiki core
MediaWiki depends on some external libraries which are managed with Composer. Composer creates an autoloader at, which is included by.

Composer managed dependencies are bundled into tarball distributions of MediaWiki and extensions so system administrators do not need to use composer directly. When installing MediaWiki using Git, dependencies declared in  can either be installed locally by running   or the   repository can be cloned to provide the same libraries used on the Wikimedia production cluster.

Resources

 * How to install extensions through Composer
 * Extension:Extension Installer - must be used for MediaWiki ≤ 1.21.x to install extensions with Composer
 * List of extensions that can or must be installed with Composer
 * Category:Extensions supporting Composer
 * How to add external libraries to MediaWiki core or extensions
 * Best practices when creating a composer.json
 * Information about adding packages to packagist.org