Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126457 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 8FBFA1A00BC for ; Tue, 18 Feb 2025 19:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1739907740; bh=8Mg8AL1GUuTjy/hkDmLzhLFBOArzVHzGskvjXUCVu+s=; h=From:Subject:Date:References:In-Reply-To:To:From; b=jMBEEWcdClbC6O+kqdhCMpvCMPP7Ia+N/CmJRi5ng9GSq9rlP0sJ+Vmz+IjeHgtb7 apPcMnkT6YC/YC2yzRYq44knUPcaCK428XEJ3UGlhsUwq7OsgT+XRGF9Foj3cAchDL XB7s4a2jM0dB6Vov7l9dMP5M5Am8F9K8nMJKMa0HdyuNLfC9+mkaLxrqZ4gLKMnGlg Lzf3Lx0/IrhE8juLL8LyDCUvMvQNtMwL9CRdu+xqJO79d5obr6ADmoDf84QHj7axLH nLpq7u+X7q374+WUoreykqTg35VxHClnj2NRvaYjs7hWRzXKD2R05LHA7gFl4f9Ynd +OHzIPIWiSYHg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8724B1805DA for ; Tue, 18 Feb 2025 19:42:19 +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=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,HTML_MESSAGE, MIME_HTML_ONLY,MIME_HTML_ONLY_MULTI,MIME_QP_LONG_LINE,MPART_ALT_DIFF, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) (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 19:42:19 +0000 (UTC) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-6f768e9be1aso1369427b3.0 for ; Tue, 18 Feb 2025 11:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benramsey.com; s=google; t=1739907899; x=1740512699; darn=lists.php.net; h=to:in-reply-to:references:message-id:date:subject:mime-version:from :content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=hM09sZvsx9P8WhC/FnFfpCVXXirJsUuPWCsAT8T3vKE=; b=Y3Yw/tJhdfgJAXV5kxT+3iG4GRFHArKzXD14HgOH6XMZbV6oKFngMN5d1+ChuwvKg8 qMObINUFYtIfls4x9Z6w6ie99ApzSNVDZ7JLtA/GxhlX4cBkeKKqX0ZqOkMgiTiH4sfn AfZedIpumVUVylLX9gUa1+XG6t/RByWoU/ufuOgnTtCSmXdNOQH+zy05lu5Iffgf8JhE Guzsuj4Buv+mxDo+7Pw6ZI1MwP29wm9caBGFz+nQ3ACtaQevizWAnVAPl8cEK+LCWH0C Oq92vr0R5u44h8MF3CJaGAlSqJ1aWPjCgeX0nucr64tdWjdZLnXTAeFEKb2GWmZ2Dl1m CJ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739907899; x=1740512699; h=to:in-reply-to:references:message-id:date:subject:mime-version:from :content-transfer-encoding:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=hM09sZvsx9P8WhC/FnFfpCVXXirJsUuPWCsAT8T3vKE=; b=POLL8BkIO1ZwnUYDL4ClezaeVngKXbLGREUirQiQ2mT0ZVk2sWaWmBsjd5OlibLGhb 5BuMv7Z/iGZ42cngOWB6GXkuFD2MiZycPajk9hlGRO3iom9mquxYp9PhxxD0fUzRNz3l 5OK4NZKNKEtpAUp6ENN1AFRD8dy6qX5XROSoatRUYn1EbSOA8OaeHPo23GJKR7BsXLf5 7UKCY+LCBPjUDHZcBOZCUa2Ntl5O0LfZ8QCdG3Tlr3Xpe6TghQ2j0ADxsl+yuBAEQgJK NcaVy0defMp77lB04CXinL6o/iD5nDKH2iOW7e6es0Xf8IRoijxkpORhSogFW+pNAQTg hRRg== X-Gm-Message-State: AOJu0Yws+pllim+x5V31iBhAMJJ/yogN7BflHh5+5jaL4s/QKWeE+YsE 72qzo0Ehfq/CFnDYCHVV1N/3knyFEcb5FqMRaYn+UKXtWlpqnqN4vN6yfnDTWnHCl3T0I9E+B2o = X-Gm-Gg: ASbGnctOetxMFvlRyc6KPbAQGOXov3tveMownPNb5D7npgaXE4XWoodrw5AjnqqZccN w99D3yy92WeEDpynLpyF+N8pjFNLv6vzturEkZc63nBoDXLYsxFMCUH32aiJ8ZEH3EwTcVQqUK3 7HNLmKH2FUD+fsJoBEGvmHkN+s5RamCRSEfahCbz1DYR4jcHr0LjxMCpzS7UeDwgFxV4aznzMt/ xBstbTp9JN4i9sXLrZ2iUcP3w8iROXNroL15P/JpEwyR6Wtlu5cN9fzlTlwABJH5yVWVZMqErOy 2vCqcSfz1f4GOLdQJVrIxbo8auuICzkcBebJipumNNPBfd5BItOR7ceGJM0BkMiFTENgIyxbW+B uzKmwW54= X-Google-Smtp-Source: AGHT+IFiqSMP+7XlvM5Aj5NpU05l9ZLDIQ+1xTPPacSze00J+be35+Ng2aejhp37sMzLpmfVVFolEg== X-Received: by 2002:a05:690c:2909:b0:6fb:761e:fb4 with SMTP id 00721157ae682-6fba51554b4mr10823107b3.5.1739907899444; Tue, 18 Feb 2025 11:44:59 -0800 (PST) Received: from smtpclient.apple (h96-61-170-179.lvrgtn.broadband.dynamic.tds.net. [96.61.170.179]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6fb3605bdd5sm27796387b3.36.2025.02.18.11.44.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Feb 2025 11:44:59 -0800 (PST) Content-Type: multipart/alternative; boundary=Apple-Mail-BC87CCA0-8B25-4E1C-B939-17DDAAAC674C Content-Transfer-Encoding: 7bit Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (1.0) Subject: Re: [PHP-DEV] [RFC] Modern Compression (zstd, brotli) Date: Tue, 18 Feb 2025 13:44:48 -0600 Message-ID: <0E1ACB43-AED4-43BD-8E6B-A86657A23A9D@benramsey.com> References: In-Reply-To: To: PHP internals list X-Mailer: iPhone Mail (22D72) From: ben@benramsey.com (Ben Ramsey) --Apple-Mail-BC87CCA0-8B25-4E1C-B939-17DDAAAC674C Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
= On Feb 18, 2025, at 08:43, K=C3=A9vin Dunglas <kevin@dunglas.fr> wrote= :

=EF=BB= =BF
Hi there,

Here= is an alternative proposal we just discussed with Jordi:

First, redu= ce the scope of our RFC to simply add new stream wrappers for Zstandard and B= rotli similar to those already provided for zlib: https://www.php.net/manual/en/wrapp= ers.compression.php

PECL extensions for Brotli and Zstandard alre= ady provide these wrappers, and Symfony AssetMapper uses them when available= .

To keep things moving quickly, we won't be adding any new functions= or classes (perhaps just constants or enums for context options).

To= use these new formats, we'll need to use the low-level file/stream manipula= tion functions. It will be possible to provide userland libraries with a mor= e attractive API.

As a second step, in a future RFC, we could create a= new "Compress" interface (or class) similar to that implemented by Go's "co= mpress" module (https://pkg.go.dev/c= ompress) or Java's InputStream/OutputStream abstraction (https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/io/= InputStream.html / https://docs.oracle.com/en/jav= a/javase/23/docs/api/java.base/java/io/OutputStream.html), which would o= ffer a high-level API for compressing or decompressing files, and which woul= d use stream wrappers under the hood.

In this way, we can move ahead q= uickly and quickly provide support for Brotli and Zstandard, which we urgent= ly need to support natively for Composer, Symfony, and probably many other p= rojects, and we can take the time to think about a well-designed high-level A= PI.

--
K=C3=A9vin= Dunglas



This streamlined and narrower-sco= ped approach gets a big +1 from me.

I also really l= ike the idea of a unified compression OO API, as future scope.
Cheers,
Ben

= --Apple-Mail-BC87CCA0-8B25-4E1C-B939-17DDAAAC674C--