Comments (3)
The usage of discoveries is covered in the general section.
do i simply need to call HttpAdapterDiscovery::find() and thats it?
Yes, it is that simple.
and for creating messages, i need the MessageFactoryDiscovery::find()->createRequest?
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.
and what is the uri factory for?
IIRC @ddeboer created that one, he specifically needed that and I had nothing to say against it.
the MessageFactory accepts a string as well (the doc is incorrect btw, it should state that it can also accept an UriInterface)
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.
from documentation.
The usage of discoveries is covered in the general
http://php-http.readthedocs.org/en/latest/discovery/#general section.
ah, right. hm but that is rather abstract to read. i will try to do a PR
with a little usage tutorial.
the MessageFactory accepts a string as well (the doc is incorrect btw, it should state that it can also accept an UriInterface)
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.
okay, the doc mistake was in guzzle psr7 Request:
guzzle/psr7#35
from documentation.
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!
from documentation.
Related Issues (20)
- Add documentation on plugin decoration.
- [CachePlugin] document hash key generator
- the doc about the bundle talks about deprecated configuration settings HOT 1
- Update symfony profiler screenshots
- [cache] document the hash_algo option
- [framework integration] Integration for Nette FW HOT 3
- MultiPart Request return Error: escapeshellarg(): Input string contains NULL bytes HOT 1
- Add docs about artax-adapter
- PluginClientFactory documentation HOT 2
- HTTPlug Maturity Model HOT 5
- Symfony bundle docs advise against proper TLS HOT 2
- Testing doc section for dev branch only HOT 6
- Update documentation on RetryPlugin HOT 2
- a client service or alias has been removed HOT 5
- Document RequestMatcherPlugin
- Document conditional with MockClient::on HOT 2
- Curl configuration raises a warning HOT 3
- No PSR-17 stream factory found, but I have one installed HOT 4
- Documentation search does not work HOT 1
- Class *** Not Found issue in php-http/discovery HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from documentation.