Need an expert to help you on your Symfony or PHP development project? Contact us and get a quote


Introducing PIE: The Modern PHP Extension Installer

· Oskar Stark · 2 minutes to read
Image of a desk with a laptop and monitor

Discover PIE, the new PHP Installer for Extensions, a modern tool that simplifies managing PHP extensions with a Composer-like workflow. Say goodbye to PECL complexities and streamline your development process with PIE.

The PHP ecosystem continues to evolve, and with it comes a groundbreaking new tool: PIE (PHP Installer for Extensions). PIE is designed to simplify and modernize the installation and management of PHP extensions, much like how Composer transformed dependency management in PHP projects.

While PECL has long been the standard for managing PHP extensions, PIE introduces a more developer-friendly approach that aligns with modern workflows. In this post, we’ll explore the capabilities of PIE, its advantages over PECL, and how you can get started.

What is PIE?

PIE (PHP Installer for Extensions) is a command-line tool that makes installing and managing PHP extensions as straightforward as using Composer. PIE treats extensions as first-class citizens in the PHP ecosystem and allows developers to install them directly from Packagist repositories.

Core Features of PIE:

  • Simplified Installation: Install PHP extensions with a single command.

  • Composer-like Workflow: Integrates seamlessly into modern PHP development practices.

  • Version Compatibility: Install extensions for different PHP versions with ease.

  • User-Friendly Syntax: A familiar syntax like pie install vendor/package.

PIE is especially helpful for developers who want to avoid the complexities of PECL or manual compilation steps.

Comparing PIE and PECL

While PECL has been the traditional method for installing PHP extensions, it comes with certain limitations that PIE addresses. PECL relies on a centralized repository and requires manual steps for installation, often making it cumbersome for developers unfamiliar with its process. In contrast, PIE introduces a modern approach similar to Composer.

With PIE, developers can install extensions using simple commands like pie install ext-redis, pulling them directly from Packagist. It also allows you to specify versions easily, such as pie install ext-redis:^5.3, enabling better control over compatibility with different PHP versions.

Where PECL requires manual intervention for enabling extensions and managing dependencies, PIE automates much of this work. It integrates seamlessly with modern PHP workflows, making it easier to include extensions as part of your project setup or CI/CD pipelines.

In short, while PECL has served its purpose for years, PIE offers a cleaner, more developer-friendly experience, aligning with modern PHP tools and practices.

Getting Started with PIE

Getting started with PIE is straightforward. Follow these simple steps:

1. Install PIE:Download the pie.phar executable from the official repository and move it into your system's $PATH :

wget https://github.com/php/pie/releases/latest/download/pie.phar  
chmod +x pie.phar  
mv pie.phar /usr/local/bin/pie

2. Installing an Extension:Use PIE’s simple syntax to install any extension:

pie install ext-redis

This command will download and configure the Redis extension automatically.

3. Specify Version Requirements:Similar to Composer, you can install a specific version:

pie install ext-redis:^5.3

4. Enabling the Extension:PIE simplifies the process, but you still need to enable the extension in your php.ini file:

extension=redis.so

Example: Installing Multiple Extensions

With PIE, you can streamline the installation of multiple extensions for your project. Consider this example for a typical setup:

pie install ext-redis ext-xdebug ext-pdo_pgsql  

This command installs Redis, Xdebug, and PostgreSQL PDO extensions in one step, saving time and effort.

Real-World Benefits

1. Simplicity for Developers:

With a familiar syntax and modern workflow, PIE is much easier to use than PECL.

2. Better Integration with Projects:

Extensions are available on Packagist, meaning you can declare them alongside your Composer dependencies in composer.json for consistent project environments.

3. Improved Version Management:

PIE allows you to specify versions, ensuring compatibility with different PHP versions during local development, testing, and production.

4. Faster Automation:

PIE’s command-line capabilities integrate seamlessly with CI/CD pipelines, making extension installation part of your automated workflows.

What's Next?

While PIE is still in its early stages, the community is quickly adopting it as a modern alternative to PECL. The PHP Foundation, along with extension maintainers, continues to improve PIE and add support for more extensions.

Conclusion

PIE represents a significant step forward for PHP developers. By bringing a Composer-like workflow to PHP extensions, PIE eliminates the frustrations of manual installations and dependency management.

If you’re already using Composer in your projects, adopting PIE will feel natural and provide a cleaner, more modern way to manage PHP extensions.

Ready to try PIE?

Head over to the official PIE GitHub repository to get started and give your PHP development workflow the upgrade it deserves!

Image