id()
id() : string
The stable identifier recorded in a frame header.
Returns
string —A short lowercase token such as "zstd", "gzip" or "none".
Brotli through `ext-brotli`.
Reaches the highest ratio Strata measured on Drupal-shaped data - 7.68x whole-stream and 6.31x in 8 KiB frames - but at 0.7 MB/s at its top quality, roughly a quarter of zstd -19's throughput for a comparable result once zstd has a trained dictionary. The extension does support dictionaries, through the fourth argument to brotli_compress() and the second to brotli_uncompress().
It is offered rather than preferred on throughput, not on capability: a site with ext-brotli
and not ext-zstd is better off here than on gzip, and CodecRegistry orders it accordingly.
levels() : array{min: int, max: int, default: int, fast: int, dense: int}
The compression levels this codec accepts.
The usable range, the default, the level to use on the flush path where throughput matters, and the level to use during compaction where ratio matters.
compress(string $data, ?int $level = null, ?string $dictionary = null) : string
Compresses a buffer.
| string | $data | The bytes to compress. An empty string compresses to an empty string, so that an absent payload never becomes a non-empty frame. |
| ?int | $level | A level within CompressionCodecInterface::levels(), or NULL for the default. |
| ?string | $dictionary | Raw dictionary bytes, or NULL. Ignored by codecs that report no dictionary support, so a caller never has to branch on it. |
The compressed bytes.