Skip to content

Commit c178098

Browse files
authored
Update README.md
1 parent 1b69f21 commit c178098

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,38 @@ $errorHandler = new ErrorHandler([
6767

6868
**Note:** If no formatter is found, the first value of the array will be used. In the example above, `HtmlFormatter`.
6969

70+
### How to use a custom response in Production
71+
72+
```php
73+
class PrettyPage implements StreamFactoryInterface
74+
{
75+
public function createStream(string $content = ''): StreamInterface
76+
{
77+
return Factory::createStream('<strong>Pretty page</strong>');
78+
}
79+
80+
public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
81+
{
82+
// This is safe as the Middleware only uses createStream()
83+
throw new Exception('Not implemented');
84+
}
85+
86+
public function createStreamFromResource($resource): StreamInterface
87+
{
88+
// This is safe as the Middleware only uses createStream()
89+
throw new Exception('Not implemented');
90+
}
91+
}
92+
93+
94+
$errorHandler = new ErrorHandler([
95+
new HtmlFormatter(
96+
null,
97+
new PrettyPage,
98+
),
99+
]);
100+
```
101+
70102
---
71103

72104
Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes and [CONTRIBUTING](CONTRIBUTING.md) for contributing details.

0 commit comments

Comments
 (0)