Skip to content

Conversation

@TiMESPLiNTER
Copy link
Contributor

No description provided.

@TiMESPLiNTER TiMESPLiNTER requested a review from nick-zh August 12, 2021 13:32
@TiMESPLiNTER TiMESPLiNTER requested a review from healerz August 12, 2021 14:53

if (false === isset($container[self::REQUEST_FACTORY])) {
$container[self::REQUEST_FACTORY] = static function (Container $container) {
if (false === isset($container[self::REQUEST_FACTORY]) && class_exists('Nyholm\Psr7\Factory\Psr17Factory')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of service providers in libraries anymore, how about removing it and "replace" it with a "how to use" part in the readme? 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what do you do then? Just duplicating stuff? I was also thinking about the whole reusable service providers. In this case here we could make it configurable with service ids you can inject over the constructor so it can locate a request factory and a client and works for the schema api client... or do you just started duplicating the whole service provider logic over and over again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, yes ^^ To me, service providers are application-specific glue code and therefore shouldn't be provided by libraries.
In the core project, we just made the experience that sooner or later the service providers provided by the libraries don't suit the application needs at some point, either because of different dependencies for the same interface, because of the introduction of either an adapter or a decorator or because you want to re-use an already registered service, etc. Another benefit imo is that if you don't use the provided service provider it's easier to see how the application is "glued" together. And on top of that, we could get rid of the additional dependencies in the libraries.

But I guess this is highly opinionated 🙂 . So I'm not saying we must get rid of the service providers in the libraries since everyone is free to not use them and I agree your solution provided with this PR is an improvement. Especially due to moving the "external" dependencies to the dev-dependencies 👍

So either way is fine to me, just quickly wanted to raise the thought. One suggestion I have, though, is that we should use PSR-11 instead of pimple, that way, it's at least container implementation agnostic.

@TiMESPLiNTER
Copy link
Contributor Author

@healerz You need to merge it now. 😉

@healerz
Copy link
Contributor

healerz commented Oct 22, 2021

@TiMESPLiNTER do I? 😆
Sorry, I completely forgot about this PR.
So you're using this public library? 🙂

@healerz healerz merged commit 0bd1f3c into main Oct 22, 2021
@healerz healerz deleted the chore/clean-up-dependencies branch October 22, 2021 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants