File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff 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
72104Please see [ CHANGELOG] ( CHANGELOG.md ) for more information about recent changes and [ CONTRIBUTING] ( CONTRIBUTING.md ) for contributing details.
You can’t perform that action at this time.
0 commit comments