Page MenuHomePhabricator

Please add `composer/installers` to requirements of Extension:ExternalData
Closed, ResolvedPublicFeature


Extension:ExternalData features a name attribute in composer.json. Therefore it should probably be installable by composer. Unfortunately it is lacking the required composer/installers dependency.


This ticket is meant to discuss

Event Timeline

External Data is not published at Packagist anyway.

Change 779752 had a related patch set uploaded (by Robert Vogel; author: Robert Vogel):

[mediawiki/extensions/ExternalData@master] Allow installation via `composer`

Change 779752 merged by jenkins-bot:

[mediawiki/extensions/ExternalData@master] Allow installation via `composer`

Osnard claimed this task.

Thanks for merging!

If Composer for this extension is sorted out, perhaps something can be done about T259743, so that manual composer require mongodb/mongodb is no longer necessary to access MongoDB.

@Osnard - I know it's strange to follow up on a patch so much later, but: is the "composer/installers" line really necessary in composer.json? It looks like most extensions' composer.json file lacks such a line - even Semantic Drilldown, which I assume is meant to be installed via Composer:

Well, without composer/installers, composer will install this package into $IP/vendor/ rather than into $IP/extensions/. SemanticDrilldown has a hard dependency to SemanticMediaWiki, which again requires composer/installers [1]. If just one of the extensions you require also requires composer/installers you are good. But as ExternalData is meant to be used standalone, I believe it should have this requirement on its own.


I did a quick grep trough the composer.json files of various extensions (that are not maintained by Hallo Welt). The files I have may be slightly outdated though. Here is a list of extensions that have composer/installersin their composer.json:


Thanks for the information - that's very interesting. I had wondered about how Composer could get the code into the extensions/ directory.

Given that, I am surprised at the relatively small number of extensions (and skins?) that contain this line, i.e. are actually installable via Composer. I know your list is far from comprehensive, but still I'm pretty sure that the overall number is quite a bit lower than 50%. Even major extensions like ParserFunctions, VisualEditor and Scribunto lack the line - which I guess means that, until now, their composer.json file has been useless. (?)

One big issue with this line is that it's not clear what the Composer version number should be set to. The "composer.json best practices" page says it should be set to ">= 1.0.1", but links to an example where it's set to "^2|^1.0.1". You set External Data's value to "~2.1", but according to bug T340818 (which caused this whole discussion), that conflicts with Page Forms' value, which is "1.*,>=1.0.1". Is there a single value that will work for all extensions? (And, ideally, will keep working as Composer versions increase?)

Most Wikimedia extensions do not feature this requirement. Wikimedia Foundation uses composer only for CI purposes. They intentionally do not make the composer.json file packagist compatible., as they do not support composer as a installation method. At BlueSpice we have adopted it and all our extensions (even the not BlueSpice-prefixed ones) support installation by composer.

You can set "composer/installers": "~1.0|~2". It should be the most compatible thing.

Thanks again - all that information is helpful. (I sort of knew that composer.json was also used for CI, but wasn't sure about it.)

That value looks good - I might update the "composer.json best practices" page with it, not to mention a bunch of extensions. Would it make sense to set this value for External Data as well?

Actually, maybe 1 - 2 is the easiest-to-understand value, and it seems to be equivalent, according to this. What do you think?

I just changed the value in External Data to include Composer v. 1 as well, here: