Help:Using Composer/Add packages

There are two possible methods on how to add packages using Composer. In both cases the execution of either  or   is required from the MediaWiki root directory.

composer.local.json
Extend your "composer.local.json" file and run  afterwards:

composer.json
Use  to invoke a change to the "composer.json" file.

Difference between "composer.json" and "composer.local.json"
MediaWiki 1.25+ itself started to facilitate the use of "composer.json" for its own library dependency management therefore it has been suggested by MediaWiki core developersCiteRef::install:composer:local to use "composer.local.json" to add local packages to avoid merge conflicts with subsequent software updates. Since "composer.local.json" is a MediaWiki specific convention,  does not work on this file and instead has to be edited manually.