Projects like Drupal, Symfony, and Laravel, allow users to create a new project with Composer and then manage extensions, themes, or other dependencies with Composer's CLI. While you can edit the composer.local.json in a new MediaWiki project, you cannot use the Composer CLI. If a user attempts to use the CLI, which is the only interface for Composer, then it will modify the root composer.json which users of MediaWiki are not supposed to do as it will make upgrading more difficult as they will have to merge their changes with the changes from MediaWiki core.
From the mediawiki root, execute:
composer require pear/mail
which is one of the suggested dependencies.
doing a git status will reveal that you've now modified the composer.json in the root. It's now more difficult to upgrade MediaWiki because you'll have to merge these changes with whatever comes from upstream.
- Create a new mediawiki-project repo with the namespace mediawiki/mediawiki
- Create a composer.json in the root of this repo that would require mediawiki/core in a ./core folder. (Example)
Doing this would not affect current packaging workflows. It would allow packaging to continue as normal.
In addition to solving the problem, it also enables:
- People can do a composer create-project mediawiki/mediawiki to setup a new project ("This is the equivalent of doing a git clone/svn checkout followed by a composer install of the vendors"). Within their project, mediawiki/core would be pulled in as a dependency, excluded from version control. The root composer.json and composer.lock can be tracked in their version control since the user will have their own Git repo and /html/core will be updated with composer.
- Allow extensions and skins to be downloaded with the Composer CLI, e.g. using composer require mediawiki/vector-skin
composer create-project davidbarratt/mediawiki