Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126449 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 83FE01A00BC for ; Tue, 18 Feb 2025 13:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1739886777; bh=9TL0SdUlPEQeCjx3OhqJvjAzRVvIS9gyv59tAy0WXBU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=W2GnxeeHeOmAxTSamoAjFrVTuxCA/SeCfqcm828D6cuBwRghJ3/tqMAxAR4V7xrDw n4/N2v98gMmzt/lt7qGIYPTTvASUhuUrXwt5b2EOVi/9JdSKxnof5tpQ/Dj4FTmaVv xVaH87Vu6hOqqW4LwpcLJ+Qvn+UU3m4jrAX53UduBoycOxvEfvNCzDsaaGC9YCb2F1 AZgfboc4mrcJxWlSm/b8AE/1CIr4eKMufem7QrLGvQScXU/FpETjRH7Vo093o/JxKO W/lLbJHxHZrolfL/JI1bTN28lsoZA3OC6kZlkhVKeh5iAdO0Mz3NcoyHH3qnmkfSwi BeJdOqA2qJQag== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E83441801DE for ; Tue, 18 Feb 2025 13:52:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 18 Feb 2025 13:52:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1739886932; bh=YiwUgICiJfZluCgVC2R0dcHrjKIqIzQh+nztAOs1fkY=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=JjoVrGRLHMK7V0btQ7OTBQPs4H7rlnEO2LhIPqGYkBy82gWT8ChMXtlwXbZahI02g 4WOOMJFgNz4MYghBKAjQ+sS4OuVADNzf143DyVlwQ5K1vk5IeP3DdeOZS1VzYsxwIF bwYNEdWmmLlIYjdHF+W0hug5xXDPE86e7e1zsHexHkBTPdJV5K7nyVULcAp3qMB5aX oAJDqlHSZCkcSEj0FVPZS4YCQFT9s3/DziG7o+zeoPYUJnbpoQRQgV7D+4N2J5hbEJ I0jNty3vwujUn0v/Kbsx6v4wzXyhYwMbs9m+UqywAvnydt2GAeVl4MwEhQYMZEaNHQ ZH+PkDr+PN4QQ== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Tue, 18 Feb 2025 14:55:32 +0100 To: Paul Dragoonis Cc: Jordi Boggiano , Internals Subject: Re: [PHP-DEV] [RFC] Modern Compression (zstd, brotli) In-Reply-To: References: <528e16e1-1fb3-448a-b187-7cc84e1bcc4a@seld.be> <5fa7423e-d723-451e-a73d-a98512a6ca96@seld.be> <8256945f09944cb16db34fd8139da63e@bastelstu.be> Message-ID: <1856be6ad7a51bf5ea56001eb719897a@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-02-18 14:22, schrieb Paul Dragoonis: > Having spent many years in PHP-FIG and lots of effort trying to build > one > "standard" for lots of implementations that differ. I just want to > point > out that I think we should avoid trying to make a standard design for > all > the Compression drivers and features and instead agree that things > (Enums?) > will and should differ from drive too driver and that'd okay. Given that all compression algorithms work in a “put source data in get compressed data out” fashion, I believe it is reasonable to have an interface specifying that to allow for proper pluggability in the output pipeline: if (in_array('brotli', $request->getHeader('accept-encoding'))) { $compressor = new \Compression\Brotli\Compressor(\Compression\Brotli\Mode::Text); } elseif (in_array('zstd', $request->getHeader('accept-encoding'))) { $compressor = new \Compression\Zstd\Compressor(); } elseif (in_array('gzip', $request->getHeader('accept-encoding'))) { $compressor = new \Compression\Gzip\Compressor(level: 6); } else { $compressor = new NullCompressor(); } echo $compressor->compress($response->getBody()); I trust Jordi to come up with a reasonable API design. Best regards Tim Düsterhus