-
Notifications
You must be signed in to change notification settings - Fork 56
document how to use discovery #2
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
The usage of discoveries is covered in the general section.
Yes, it is that simple.
It is not specifically mentioned in the documentation, but IIRC the discovery classes contain docblock about the returned types. MessageFactoryDiscovery returns a MessageFactory which you can use to create messages. While discoveries has caching builtin, I suggest storing the discovered object internally in your class, so that you only have to call the discovery once.
IIRC @ddeboer created that one, he specifically needed that and I had nothing to say against it.
No, it is on purpose. The factory accepts string as well so you can create your request object directly without the need for creating an Uri object first. The other reason it is there is that every PSR-7 implementation differs: one accepts string in it's constructor, another doesn't. This tries to make it consistent: each accepts everything. I think I answered all your questions. If you feel a PR is still necessary or you think you can improve the docs so that other people won't have to ask these questions again, please feel free to submit a PR. |
ah, right. hm but that is rather abstract to read. i will try to do a PR
okay, the doc mistake was in guzzle psr7 Request: |
Looking at the docs, there are code examples about using the specific discoveries as well: http://php-http.readthedocs.org/en/latest/discovery/#http-adapter-discovery Thank you for contributing! |
the discovery section only explains how to provide discovery for your own project. but i am trying to figure out how to just use discovery in my project. imho the doc should also explain that.
do i simply need to call HttpAdapterDiscovery::find() and thats it?
and for creating messages, i need the MessageFactoryDiscovery::find()->createRequest?
and what is the uri factory for? the MessageFactory accepts a string as well (the doc is incorrect btw, it should state that it can also accept an UriInterface)
i am happy to do a PR to add a usage section, but first want to be sure to understand correctly how things work.
The text was updated successfully, but these errors were encountered: