Composer/fr

Composer est un gestionnaire de dépendances pour les bibliothèques PHP. En plus, il peut être utilisé pour gérer l'installation des extensions MediaWiki (depuis ). À partir de, les dépendances des bibliothèques externes du noyau de MediaWiki sont gérées par Composer.

Sous Unix/Linux et macOS
Il existe plusieurs manières d'accéder à install Composer, à côté de la plus évidente, :

Pour récupérer la dernière version :

Ceci télécharge l'image du master actuel et expirera dans 30 jours. Il existe aussi des archives PHP (phars) pour les « versions » alpha comme 1.0.0-alpha.

Pour les utilisateurs sous OS X, vous pouvez utiliser Homebrew pour installer Composer :

Si cela ne fonctionne pas, ou que vous n'avez pas installé Homebrew, vous pouvez essayer :

Jenkins et le distributeur d'extensions utilisent la copie de composer contenue dans le répertoire Git « integration/composer ».

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

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

If the mv command fails due to permissions, execute it again with sudo.

Sous Windows
Téléchargez simplement et exécutez l'installeur à partir de la page de téléchargement. If you prefer manual installation, you can follow the above steps except that Windows doesn’t have wget (or APT or Homebrew) by default, and there is no /usr/local/bin directory.

Utilisation dans le noyau MediaWiki
MediaWiki 1.25+ 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.

Utilisation du plugin composer-merge
MediaWiki core "owns"  and will change the contents of that file in both tarball and Git managed updates. In order to allow local installs to use Composer to load optional libraries and/or manage extensions with Composer, a special plugin for Composer named composer-merge-plugin was developed. This plugin and the MediaWiki core  configuration allow a local deployment to add required extensions and libraries to a file   inside the root MediaWiki directory.

can also be used to install Composer managed libraries that are needed by extensions that are not installed using Composer themselves. This is only needed when the extensions are not installed from tarballs generated by Extension Distributor.

To enable Composer to discover and process the  files that may be included in any and all of your locally installed extensions, add something like this to  :

Ressources

 * - must be used for MediaWiki ≤ 1.21.x to install extensions with Composer
 * List of extensions that can or must be installed with Composer
 * List of extensions that can or must be installed with Composer