Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide support for "wordpress-core-implementation" #22

Closed
gmazzap opened this issue Mar 11, 2021 · 3 comments
Closed

Provide support for "wordpress-core-implementation" #22

gmazzap opened this issue Mar 11, 2021 · 3 comments

Comments

@gmazzap
Copy link

gmazzap commented Mar 11, 2021

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.

@swalkinshaw
Copy link
Member

I could send a PR if interested.

Yes please 😄 had no idea about this feature. No reason not to add it

@swalkinshaw
Copy link
Member

The most popular (at the moment) being https://packagist.org/packages/johnpbloch/wordpress-core

Looks like this package has surpassed it in weekly installs 🎉

@swalkinshaw
Copy link
Member

Added, but of course this will only apply to new versions going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants