Forest header image

Symfony Finland
Random things on PHP, Symfony and web development

Pickle to integrate PHP component and C extension management

There is an interesting project in the PHP domain called Pickle. It aims to replace PECL (incidentally pronounced 'pickle') as the platform to distribute and install PHP extensions in the same way we have come accustomed to doing with PHP components with Composer.

Since early days of PHP has had the opportunity of being extended by extensions written in the C programming language. These extensions provide high performance and access to lower level resources in the operating system than applications written PHP can. You can install these extensions via the OS packet management (mostly talking about Yum and Apt) or the PECL manager.

A fine modern example of a popular PHP extension is the Mongo DB PHP Driver. Others include PHP-intl and other general purpose libraries. There are CMSes and frameworks require an extension to PHP written in C: Midgard CMS and Phalcon. Writing and sharing PHP code used to be quite a hassle, but nowadays that has been greatly improved, but for extensions there's plenty of room to improve. The same was true for PHP code and PEAR, which later Composer replaced.

PHP extensions are commonly shared using the PECL, a community and tool for PHP extensions. PECL has been around for a long time and it works very well. The problem with PECL is that it taxes developers of the extensions unreasonably. As good as PECL maybe for consumers, it has is quite tedious for providers - people who write C extensions for PHP.

In an ideal world PHP would be so fast and have access to lower level that we would no longer need extensions written in C. This won't be the case with either PHP 7 or HHVM, so we'll need to keep the ball rolling. To address some of the of these issues there is now an effort from the Friends of PHP called Pickle.

Pickle aims to keep end user experience to a minimum level of PECL, but improve the life of developers a lot:

For developers, it drastically reduces the release work. Extension meta information is not duplicated anymore. Configuration options, files to package etc. are automatically fetched from the sources and the respective files are updated during the release process. There is no risk anymore of forgetting to update the version here or there, or to neglect to include a file.

Pickle will be compatible with existing PECL repositories, but hopes to be integrated fully with Composer (a PHP dependency manager) to provide developers a smooth experience for installing dependencies written in PHP or as extensions written in C.

Currently Composer will inform a PHP extension is required, but it has no means to install that. Pickle aims to integrate this in to the same tool - making use PHP and C libs transparent to the user. No just "The requested PHP extension ext-intl * is missing from your system" prompts, but a way to install that exension.

Jordi Boggiano from the Composer team is working together with Pierre Joye from the Pickle crew, which is a positive sign for the project:

Follow @Pickle_PHP on Twitter and read more about how to begin with Pickle on the Pickle PHP Github page.

P.S. Another interesting PHP packaging technology is Puli for PHP asset management.

Written by Jani Tarvainen on Sunday August 23, 2015
Permalink - Tags: php, pickle, clang

« Break down the silos, PHP developers - WordPress, Drupal and eZ Publish Data and Content Migrations »