Composer/nl

Composer is een hulpmiddel voor het beheren van afhankelijkheden van broncode van PHP-libraries. Vanaf versie worden de externe afhankelijkheden van MediaWiki met Composer beheerd. Het kan ook worden gebruikt om de installatie van MediaWiki extensies te beheren (beschikbaar vanaf versie ). Dit wordt nog niet goed ondersteund. Dat kan in de toekomst dus nog beter worden.



Composer installeren


Op Unix/Linux en macOS
Het installeren van Composer kan op meerdere manieren, voor de hand ligt deze manier:.

In MediaWiki 1.31, 1.35.0 en 1.35.1 wordt alleen Composer 1.x ondersteund. Ophalen meest recente stabiele Composer 1.x release:

Composer 2.x en Composer 1.x worden ondersteund in MediaWiki >= 1.35.2 (samen met de REL1_36 branch en master). Ophalen meest recente stabiele Composer 2.x release:

Gebruikers van macOS kunnen Homebrew gebruiken om Composer te installeren. Dit zal Composer 2.x installeren, dus u moet kijken of u die versie kunt gebruiken aan de hand van uw versie van MediaWiki, mogelijk moet u versie 1.x installeren en dus de  instructie volgen. Voor het het installeren met gebruik van :

Als dat niet werkt of als u geen Homebrew beschikbaar heeft, probeer dan:

Toolforge 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:

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.

On Windows
Just download and run the installer from the download page. 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. In these cases, you can just download composer-1.phar in your web browser and then rename it to composer.phar.

Composer 1.x
If you want to upgrade Composer to the latest 1.x stable (or downgrade from 2.x stable), you can use:

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

If you are on a really old version of composer, it may not have the  parameter. In this case, you might want to run  twice. The first may update it to 2.x, so the second will downgrade it to the latest version of 1.x.

Composer 2.x
If you are using Composer 1.x, and want to upgrade to Composer 2.x (and are using an appropriate version of MediaWiki, such as >= 1.35.2), you can use:

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

Usage in MediaWiki core
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.

Using composer-merge-plugin
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  :

After any changes to, you need to remove   before running   again so that Composer will recalculate the dependencies and the changes will take effect.

Resources

 * List of extensions that can or must be installed with Composer
 * Composer (software)
 * Composer (software)
 * Composer (software)
 * Composer (software)
 * Composer (software)
 * Composer (software)