FriendsOfPHP / well-known-implementations

Help reduce the proliferation of same-abstraction implementations in vendor directories.
MIT License
75 stars 1 forks source link

Behavior when no implementation is available #6

Closed Jean85 closed 1 year ago

Jean85 commented 1 year ago

I've already suggested this on Twitter, but it seemed nice to report this here: what should be the behavior of this package when no compatible implementation is available? (i.e. fresh/empty project)

IMHO, the plugin should ask the user which library she would prefer, and fallback to a sensible default if Composer is in --no-interactive mode.

WDYT?

nicolas-grekas commented 1 year ago

On a fresh new empty project, the plugin will do nothing, unless there is a require on one of the supported virtual packages.

Then, when a dep is added to this new project and this one needs one of those virtual packages, the plugin will look for the current deps of the project, so it will select what fits best to the set of deps. If there is no best fit, the plugin will select the first listed implementations, which are symfony/http-client and nyholm/psr7. The reason is that those are the most stable packages, in terms of long term maintenance policies.

About going interactive in this situation, that'd void the purpose of the plugin, which is to make it easy to install a 3rd party lib that relies only on virtual packages.

But if one doesn't like these defaults, adopting anything else is just a few composer commands away.