Setting up PHP extensions traditionally involved hard scenarios like finding precompiled binaries, the use of OS package deal deal managers, or manually compiling from provide. The ones methods could be inconsistent during platforms and required different directions, making the process sophisticated and susceptible to errors.
PECL, while helpful, feels antiquated. It’s no longer as easy to position your extension in PHP because it’s with Composer. PIE is an initiative from the PHP Basis to get to the bottom of this by means of treating extensions as Composer programs. It simplifies the process, supplies upper cross-platform consistency, and promises easier updates and keep an eye on for PHP extensions.
Will have to haves
Previous than we begin, you should definitely have PHP 8.1 or newer to run PIE. Alternatively, PIE can arrange extensions for any installed PHP type. To check the PHP type for your computer, you’ll have the ability to run: php -v
Arrange
To place within the PHP Installer for Extensions (PIE), you’ll have the ability to follow the ones steps:
1. Download the PHAR package deal deal
First, you need to acquire the pie.phar
document from the reliable repository or web page. That’s the theory document sought after to use PIE.
2. PHAR arrange
Switch pie.phar
into your computer’s PATH
, comparable to /usr/local/bin/
, so that you’ll have the ability to run it from anyplace. You’ll have the ability to rename it for convenience, for example:
mv pie.phar /usr/local/bin/pie
On House home windows, you’ll have the ability to switch it to C:Program Data
or some other record for your PATH
. Alternatively, I love to suggest the use of Composer and its CLI with the House home windows Subsystem for Linux (WSL) for a better experience.
3. Make it executable
On non-House home windows machines, you need to change the permissions to make it executable.
chmod +x /usr/local/bin/pie
That’s it. You’ll be in a position to try running pie
for your terminal to appear if it’s installed correctly.
We will be able to now use PIE to place in PHP extensions very simply the use of the pie
command.
pie arrange /
As an example, let’s say you need to place within the xdebug
extension to perform debugging for your PHP application. You’ll have the ability to run:
pie arrange xdebug/xdebug
This command will pull the xdebug
extension from Packagist, assemble it, and arrange it for your PHP arrange. PIE may also add the extension to your php.ini
document, in order that you don’t wish to do it manually.
You’ll have the ability to find all extensions that you simply’ll have the ability to arrange by means of PIE in Packagist.
Bear in mind for House home windows
PIE in recent years does no longer improve development extensions on House home windows. It’s dependent upon the extension creator to provide the pre-built DLL document for their extension, so there are possibly some extensions that you simply’ll have the ability to’t arrange on House home windows.
Wrapping Up
PIE is a great initiative to simplify the arrange of PHP extensions. I like how it treats extensions as Composer programs, making it easier to keep watch over and exchange them. I believe it’s a step in the proper direction to modernize the PHP ecosystem and make it further developer-friendly.
The submit Learn how to Set up PHP Extensions Simply with PIE gave the impression first on Hongkiat.
Supply: https://www.hongkiat.com/blog/how-to-install-php-extensions-with-pie/
Contents
0 Comments