File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -29,3 +29,27 @@ This package provides interfaces for PSR-7 factories including:
29
29
- ``StreamFactory ``
30
30
- ``UploadedFileFactory `` - WIP (PRs welcome)
31
31
- ``UriFactory ``
32
+
33
+ Implementation for the interfaces above for `Diactoros `_ and `Guzzle PSR-7 `_ can be found in ``php-http/message ``.
34
+
35
+ .. code :: php
36
+
37
+ // Create a PSR-7 request
38
+ $factory = new Http\Message\MessageFactory\DiactorosMessageFactory();
39
+ $request = $factory->createRequest('GET', 'http://example.com');
40
+
41
+ // Create a PSR-7 stream
42
+ $factory = new Http\Message\StreamFactory\DiactorosStreamFactory();
43
+ $stream = $factory->createStream('stream content');
44
+
45
+ You could also use :doc: `/discovery ` to find an installed factory automatically.
46
+
47
+ .. code :: php
48
+
49
+ // Create a PSR-7 request
50
+ $factory = MessageFactoryDiscovery::find();
51
+ $request = $factory->createRequest('GET', 'http://example.com');
52
+
53
+
54
+ .. _Diactoros : https://github.com/zendframework/zend-diactoros
55
+ .. _Guzzle PSR-7 : https://github.com/guzzle/psr7
You can’t perform that action at this time.
0 commit comments