Provide support for "wordpress-core-implementation"
gmazzap opened this issue · 3 comments
Summary
Add support for "wordpress-core-implementation" virtual package https://packagist.org/?query=wordpress%2Fcore-implementation
Motivation
Out there, there are several Composer packages providing WordPress files. The most popular (at the moment) being https://packagist.org/packages/johnpbloch/wordpress-core.
That package has a provide
configuration that implements the "wordpress-core-implementation" Composer "virtual package".
A few other packages are following that example (https://packagist.org/providers/wordpress/core-implementation) and if this package would do that, that would meant to have a sort of de-facto standard in the community.
Thanks to that, packages that require WordPress (e.g I maintain WP Starter) could require wordpress/core-implementation
leaving consumers the choice to install which actual implementation to use.
Additional context
This is the approach that PSR standards are following. For example, for PSR-3 there's https://packagist.org/providers/psr/log-implementation which is a "virtual package". Any real package that contains an implementation of PSR-3 can declare to "provide" the virtual package, and packages that require a PSR-3 implementation can depend on that virtuual package instead of a specific logger implementation, leaving their consumers the choice to use any implementation they want.
(Suggested reading: a old-but-good article on the topic: https://matthiasnoback.nl/2014/10/composer-provide-and-dependency-inversion/)
How to
To support "wordpress-core-implementation" virtual package the only thing to do would be to add something like:
"provide": {
"wordpress/core-implementation": "dev-master"
}
to the generated composer.json
.
See how that's done in johnpbloch/wordpress-core
.
I could send a PR if interested.
I could send a PR if interested.
Yes please 😄 had no idea about this feature. No reason not to add it
The most popular (at the moment) being https://packagist.org/packages/johnpbloch/wordpress-core
Looks like this package has surpassed it in weekly installs 🎉
Added, but of course this will only apply to new versions going forward.