@@ -38,6 +38,29 @@ brotli.ini:
3838extension=brotli.so
3939```
4040
41+ ### Experimental output handler option
42+
43+ Name | Default | Changeable
44+ --------------------------------- | ------- | ----------
45+ brotli.output\_ compression | 0 | PHP\_ INI\_ ALL
46+ brotli.output\_ compression\_ level | -1 | PHP\_ INI\_ ALL
47+
48+ * brotli.output\_ compression _ boolean_
49+
50+ Whether to transparently compress pages.
51+ If this option is set to "On" in php.ini or the Apache configuration,
52+ pages are compressed if the browser sends an "Accept-Encoding: br" header.
53+ "Content-Encoding: br" and "Vary: Accept-Encoding" headers are added to
54+ the output. In runtime, it can be set only before sending any output.
55+
56+ * brotli.output\_ compression\_ level _ integer_
57+
58+ Compression level used for transparent output compression.
59+ Specify a value between 0 to 11.
60+ The default value of -1 uses internally defined values (11).
61+
62+ > Available since PHP 5.4.0.
63+
4164## Function
4265
4366* brotli\_ compress — Compress a string
@@ -102,3 +125,15 @@ $uncompressed = brotli_uncompress($compressed);
102125
103126echo $uncompressed;
104127```
128+
129+ ### Output handler
130+
131+ ```
132+ ini_set('brotli.output_compression', 'On');
133+ // OR
134+ // ob_start('ob_brotli_handler');
135+
136+ echo ...;
137+ ```
138+
139+ > "Accept-Encoding: br" must be specified.
0 commit comments