Derick Rethans' Blog<b>And Then There Was PIE</b><br><a href="https://derickrethans.nl/and-then-there-was-pie.html" rel="nofollow noopener noreferrer" target="_blank">Original Post</a><br><br><p>In tandem with the <a href="https://pecl.php.net/" rel="nofollow noopener noreferrer" target="_blank">PECL</a> website, which hosts around 400 packages, PHP developers have been able to install third party extensions for several decades now with the PECL installer.</p><p>PECL, which stands for the PHP Extension Community Library was a sister project to <a href="https://pear.php.net" rel="nofollow noopener noreferrer" target="_blank">PEAR</a>, the PHP Extension and Application Repository. This repository has largely been replaced by <a href="https://packagist.org/" rel="nofollow noopener noreferrer" target="_blank">Packagist</a>, which hosts PHP user land code to be installed through <a href="https://getcomposer.org/" rel="nofollow noopener noreferrer" target="_blank">Composer</a>. Unlike PEAR, Packagist allows anybody to register a library of PHP code, which can then be composed through a file (<code>composer.json</code>) and made available to people's application code.</p><p>For extensions written in C, PECL was the only option. The PECL website has not been properly maintained for a long while now. And there are issues where the package description and release information XML files can not even contain higher-byte characters due to a very old misconfiguration of MySQL—back when it did not support Unicode and UTF-8 properly.</p><p>Updating the website, for example for adding new releases releases, is also not the easiest thing to do. Unlike adding a Git tag as you can do with Composer packages, it requires modifying an <a href="https://github.com/xdebug/xdebug/blob/master/package.xml" rel="nofollow noopener noreferrer" target="_blank">unwieldy XML file</a>, and uploading the packages manually through a web form.</p><p>With this in mind, about a year and a half ago, I started drafting the requirements for "New PECL". The initial goals I came up with were:</p><ul><li><p>A new simplified installer, that does not rely on PEAR</p></li><li><p>Ways to configure which (already installed) PHP version should get which extension version(s)</p></li><li><p>Cryptographic verification of released extension tags</p></li><li><p>Removing the reliance on a PECL website</p></li><li><p>No longer relying on <code>package.xml</code></p></li></ul><p>The <a href="https://thephp.foundation/" rel="nofollow noopener noreferrer" target="_blank">PHP Foundation</a> bid for funding by the <a href="https://www.sovereign.tech/tech/php" rel="nofollow noopener noreferrer" target="_blank">Sovereign Tech Agency</a> — an agency of the German government — to develop this new tool.</p><p>From my initial requirements, <a href="https://www.jamestitcumb.com/" rel="nofollow noopener noreferrer" target="_blank">James Titcumb</a> and others worked on a more detailed <a href="https://github.com/ThePHPF/pie-design" rel="nofollow noopener noreferrer" target="_blank">design</a> as part of their work for the PHP Foundation. James then set to <a href="https://github.com/php/pie" rel="nofollow noopener noreferrer" target="_blank">work on the installer</a> resulting in the <a href="https://thephp.foundation/blog/2024/11/19/pie-pre-release/" rel="nofollow noopener noreferrer" target="_blank">first pre-release</a> last November.</p><p>Since then, the tool has matured with more features, and better integration with Packagist, which now also features <a href="https://packagist.org/extensions" rel="nofollow noopener noreferrer" target="_blank">PHP extensions</a> besides public PHP packages. Many extensions, including <a href="https://packagist.org/packages/xdebug/xdebug" rel="nofollow noopener noreferrer" target="_blank">Xdebug</a>, can now be installed with PIE.</p><p><a href="https://github.com/php/pie/blob/main/docs/usage.md" rel="nofollow noopener noreferrer" target="_blank">Documentation for PIE</a> is available on GitHub.</p><p>Binary builds for Windows are also supported, and we have developed a <a href="https://github.com/php/php-windows-builder" rel="nofollow noopener noreferrer" target="_blank">GitHub action</a> to help extension authors to do this in the right way for PIE.</p><p>PIE's feature set is fairly compatible with PECL, and now is the time to start using it in your projects. There are sometimes still a few kinks, such as a recent issue with the <a href="https://github.com/mongodb/mongo-php-driver" rel="nofollow noopener noreferrer" target="_blank">MongoDB extension's</a> use of <a href="https://github.com/mongodb/mongo-php-driver/blob/v1.x/.gitmodules" rel="nofollow noopener noreferrer" target="_blank">Git submodules</a>. This is already fixed in the 0.7.0 of PIE, but more issues are likely to be encountered.</p><p>At some point in the future, the PECL website will be discontinued leaving PIE installing PHP extensions from Packagist as the only available option.</p><p>then now is the time to <a href="https://github.com/php/pie/blob/main/docs/extension-maintainers.md" rel="nofollow noopener noreferrer" target="_blank">add support</a> for PIE in your extension.</p><p>In most cases, this requires creating a <code>composer.json</code> file in the root of your GIT repository, such I have done for <a href="https://github.com/xdebug/xdebug/blob/master/composer.json" rel="nofollow noopener noreferrer" target="_blank">Xdebug</a>, and others have done for the <a href="https://github.com/krakjoe/apcu/blob/master/composer.json" rel="nofollow noopener noreferrer" target="_blank">APCu</a>, <a href="https://gitlab.com/Girgias/csv-php-extension/-/blob/master/composer.json?ref_type=heads" rel="nofollow noopener noreferrer" target="_blank">CSV</a>, <a href="https://github.com/Imagick/imagick/blob/develop/composer.json" rel="nofollow noopener noreferrer" target="_blank">Imagick</a>, and many other extensions.</p><p>that you currently install through PECL, then now would be a great time to start using PIE in your development environments. Only through superior testing will the new PIE installer reach maturity, and become ready to have a 1.0 release.</p><p>And then we can celebrate with an actual pie. 🥧</p>