-
Notifications
You must be signed in to change notification settings - Fork 39
Dependency on psr/http-message-implementation #104
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
Comments
If a client needs a dependency, the actual dependency in the class is a message factory. In an ideal case, a message factory is shipped with a message implementation. So I would say, message implementation should be required in clients, where we actually need them (either through message factories or not). However, this will still have a problem open: if there is no message factory in the package, or no puli config is present, the problem will still persist. So if discovery is used, a message implementation is not enough: there must be a message factory available as well (for Guzzle and Diactoros available in the message package, the error message contains instructions for installing it) AND it must be registered in puli. To mitigate this problem (apart from adding message implementation requirement to clients where needed), we should clearly document this and have an easy way, where we just instruct the user to install php-http/message and one of guzzle or diactoros. |
So the This will also solve the issue with the API library having a dependency on |
I think that adds unnecessary complexity. Also:
Guzzle and Diactoros are two special cases, funny or not, they are the most problematic and the most popular ones. |
Yeah, it is complex, but that's how it is.
Okey. But that does not address the issue with discovery.. Correction from above:
So the |
Another problem: what if you don't need messages, only clients? Are you still forced to install a message factory? Following this logic, httplug and a client-implementation should be required too. The fact that a message factory is not found by the message factory is not necessarily wrong. It indicates that you don't have one installed which is an error case YOU have to solve. Factory implementation virtual package does not really make sense if it is essentially the same as the message virtual package. Again, guzzle and diactoros are unfortunate exceptions. The message package does not need a message implementation either. The only justification would be having guzzle and diactoros factories in the package, but you can't install any implementations to use those. For the rest of the package, an implementation is not necessary. |
Hm. I did not think of that scenario. You are correct.
That is correct, but as stated: Those exceptions are the vast majority of the cases. I'm convinced that my idea with
Lets! |
Yes, that concerns me as well. I think most of people will want to use Guzzle 6 anyway. We already have place for a quick start guide (tutorials) where we can create examples. Hopefully people will use example code instead of just installing stuff without understanding. You and me/we could generally just install stuff, but that's a LogicException: leads to the solution immediately if something is wrong. |
In psr/log, psr/cache and other figs standard they don't require the implementation in the composer.json so i'm also against this. |
the set up can be tricky in both cases. either you end up with cryptic composer messages or with cryptic class not found errors. as long as composer does not specifically explain what went wrong when a virtual package is required i think i can live with not specifying it. if composer starts to improve there, we should reconsider. |
Httplug does not require an implementation, only the interface. Also, this issue is not really about requiring an implementation, but simplifying the installation process. With the recent changes of discovery and message this is probably a bit different now. |
It is a bit different now and I understood the reasoning why we are doing right. We need to make sure to document this clearly until we can merge factory classes to Guzzle/Diactoros. |
I would say open a documentation ticket then and close this as in it's current form, it's a blocker for the stable. |
👍 |
Test for Symfony3.1
I feel like we need a dependency on
psr/http-message-implementation
but I can not decide what package that should have that dependency. Technically no package require an implementation because that is one of our goals, but in practice you can not use any package without an implementation of PSR-7.The scenario is that an API library uses Httplug it has dependencies like:
The user tries to install the library and will first get an error like:
So he googles the error and finds our our documentation saying he need a client. He tries to install the socket-client.
Everything installs but when one tries to use the library which have auto discovery you will get an exception:
This will happen because we have no implementation of PSR-7 installed. The user has faced a lot of issues and the experience of Httplug is that it is hard do use and understand.
I would suggest we add a dependency on
psr/http-message-implementation
on one of following:The text was updated successfully, but these errors were encountered: