Composer/For extensions

You can use Composer to install MediaWiki extensions which include a  manifest and are published on the Packagist package repository.

Composer requires shell access. If you do not have shell access to the server of your website, it is also possible to set up MediaWiki and Composer on a local computer, for instance using an AMP package, and transfer the installed files to the remote server.

What is Composer
Composer is a dependency manager that automates many of the tasks one has to deal with when installing extensions. In MediaWiki's current use of composer, some work that had to be done by hand has been automated:

Because composer handles so much of the grunt work of installation, it is important to remember that you will still need to add  to your   file to use the extension.
 * Composer handles downloading the extension,
 * Composer puts the extension's files in the right place,
 * Composer verifies that any PHP extensions needed (e.g. swoole or LuaSandbox) are installed.
 * Composer can install some extension dependencies,
 * Composer automatically installs any extra PHP libraries that are needed into MediaWiki's top-level  directory.

MediaWiki's use of composer does not enable extensions by default so that separate wikis can run from the same installation of MediaWiki and only those wikis that want to use, say, SemanticMediaWiki will have it available.

Installing Composer
Follow the official download instructions to install Composer. Nothing extra needs to be done for it to work with MediaWiki.

Specify the extensions to be installed
MediaWiki ships with a  file that you should not change. This means that you cannot use  from the command line. Instead, copy  to   and modify it for your needs.

In this file, add the extensions you want to install in the "require" section. Or have a look at the examples below.

This example specifies that the SubPageList extension should be installed. It also specifies that you want version 1.4 or above, up to, but excluding, version 2.0.

For each additional extension you need, a new line is added. This example also adds Semantic MediaWiki, and specifies that you are happy with the latest version compatible with your setup.

Each line, except the last one, should have a comma at the end. Also note that you only need to specify the extensions you need, and do not have to bother with their dependencies. For instance, if you want to install Semantic Maps, Composer will automatically install its dependencies, such as Maps and Semantic MediaWiki, for you.

Also, see "basic composer usage" and "version constraints"

Installing extensions
Once you specified the extensions you want to install, run " ". To verify installation was successful, hit Special:Version and see if the desired extensions are listed.

When you want a new version of an extension, update the versions in the composer.local.json file, and run " ".

Upgrading extensions
If you are upgrading an extension from a version that does not use Composer to one that does, you will first need to (partially) remove the extension, and then follow the standard installation instructions. A step by step tutorial can be found here.

Uninstalling extensions
Simply remove the extension from your composer.local.json file, and run

Use release branches
Most MediaWiki extension do not have semantic versioning. The WMF as well as some extension authors support certain release branches. Using a release branch as version constraint will therefore ensure compatibilty to your Mediawiki Core version.

Example: Be aware that usually only the current LTS branch(es) as well as the branch of the latest release receive patches.

Use third-party package repositories
Not all MediaWiki extensions are listed on packagist.org. But you can add additional repositories to your

Common problems
Your requirements could not be resolved to an installable set of packages.

Problem 1 - Installation request for mediawiki/semantic-mediawiki dev-master -> satisfiable by mediawiki/semantic-mediawiki[dev-master]. - mediawiki/semantic-mediawiki dev-master requires param-processor/param-processor dev-master -> no matching package found.

If you run into this error, first double check that there is no typo in any of the package names. In case the names are all correct, there might be a dependency that has no matching stable release. You can specify that Composer is allowed to install packages still in development state by adding the "minimum-stability" flag to your composer.local.json file. Example: