Hi Am 2025-02-18 11:19, schrieb Jordi Boggiano:
Thanks for your consideration, we're looking forward to hearing your feedback!
The RFC specifies that:
The zstd implementation includes a few global functions as well as namespaced ones
My question is: Why? Please also have a look at: https://github.com/php/policies/blob/main/coding-standards-and-naming.rst#namespaces. Instead of creating a top-level namespace for both Brotli and Zstd it would probably make sense to create a new “Compression” extension that could also include a new and improved gzip (and bz2) API as a follow-up. The new ext/random could probably serve as an API example.
function compress_add( resource $context, […]
Please do not add new resources. It would probably also make sense to consider making this a proper OO API instead of resource objects that are processed by free-standing functions.
----- Both parts combined could then result in something like: ``` namespace Compression\Zstd; class Compressor implements \Compression\Compressor { } $file = fopen('file.txt', 'r'); $file2 = fopen('file.txt.zstd', 'w'); $decompressor = new Decompressor(); while (!feof($file)) { fwrite($file2, $decompressor->push(fread($file))); } ``` Best regards Tim Düsterhus