Skip to content

Commit 656d9e3

Browse files
Update README.md
1 parent 025d9f0 commit 656d9e3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,24 @@ $request = (new ResponseFactory)->createResponse(200);
3030
```
3131

3232
### Stream
33+
34+
#### Create Stream from a string
3335
```php
34-
// create stream from string
3536
$stream = (new StreamFactory)->createStream('Hello World!');
3637
echo $stream; // Hello World!
38+
```
3739

38-
// create stream from file
40+
#### Create Stream from a file
41+
```php
3942
$stream = (new StreamFactory)->createStreamFromFile('/path/file', 'w+');
4043
$stream->write('Hello World!);
4144
echo $stream; // Hello World!
45+
```
4246

43-
// create stream from resource
44-
$resource = fopen('php://temp', 'r+');
47+
#### Create Stream from a resource
48+
```php
49+
$resource = fopen('php://temp', 'w+');
4550
$stream = (new StreamFactory)->createStreamFromResource($resource);
51+
$stream->write('Hello World!);
52+
echo $stream; // Hello World!
4653
```

0 commit comments

Comments
 (0)