@@ -12,21 +12,57 @@ $ composer require davidecesarano/embryo-http
1212```
1313
1414## Usage
15+ * [ Request] ( #request )
16+ * [ ServerRequest] ( #serverrequest )
17+ * [ Response] ( #response )
18+ * [ Stream] ( #stream )
19+ * [ Uri] ( #uri )
20+ * [ UploadedFile] ( #uploadedfile )
1521### Request
1622``` php
1723$request = (new RequestFactory)->createRequest('GET', 'http://example.com');
1824```
19- ### Server Request
25+
26+ ### ServerRequest
27+
28+ #### Create Server Request
2029``` php
21- // create server request
2230$request = (new RequestFactory)->createServerRequest('GET', 'http://example.com');
31+ ```
2332
24- // create server request from server
33+ #### Create Server Request from Server
34+ ``` php
2535$request = (new RequestFactory)->createServerRequestFromServer();
2636```
37+
2738### Response
2839``` php
29- $request = (new ResponseFactory)->createResponse(200);
40+ $response = (new ResponseFactory)->createResponse(200);
41+ ```
42+
43+ ### Stream
44+
45+ #### Create Stream from a string
46+ ``` php
47+ $stream = (new StreamFactory)->createStream('Hello World!');
48+ echo $stream; // Hello World!
49+ ```
50+
51+ #### Create Stream from a file
52+ ``` php
53+ $stream = (new StreamFactory)->createStreamFromFile('/path/file', 'w+');
54+ $stream->write('Hello World!);
55+ echo $stream; // Hello World!
3056```
3157
32- ###
58+ #### Create Stream from a resource
59+ ``` php
60+ $resource = fopen('php://temp', 'w+');
61+ $stream = (new StreamFactory)->createStreamFromResource($resource);
62+ $stream->write('Hello World!);
63+ echo $stream; // Hello World!
64+ ```
65+
66+ ### Uri
67+
68+ ### UploadedFile
0 commit comments