PHP FAQ: Is there a package manager for PHP?
Answer: Yes, PEAR (the PHP Extension and Application Repository) is what you need. As the website describes it, "PEAR is a framework and distribution system for reusable PHP components."
Here's an example of how I used PEAR to install the
HTTP_Request library, showing both what I typed, and the output from PEAR as it performed the installation.
$ pear install HTTP_Request WARNING: "pear/HTTP_Request" is deprecated in favor of "pear/HTTP_Request2" WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update WARNING: "pear/Net_URL" is deprecated in favor of "pear/Net_URL2" downloading HTTP_Request-1.4.4.tar ... Starting to download HTTP_Request-1.4.4.tar (Unknown size) ..................done: 79,360 bytes downloading Net_URL-1.0.15.tar ... Starting to download Net_URL-1.0.15.tar (Unknown size) ...done: 30,720 bytes downloading Net_Socket-1.0.9.tar ... Starting to download Net_Socket-1.0.9.tar (Unknown size) ...done: 22,528 bytes install ok: channel://pear.php.net/Net_URL-1.0.15 install ok: channel://pear.php.net/Net_Socket-1.0.9 install ok: channel://pear.php.net/HTTP_Request-1.4.4
As you can see, PEAR downloaded the
HTTP_Request module that I wanted, and also handled all the library dependencies during the installation process.
Note that I was logged in as the root user when I entered this command. This is important, because this package was written to the following directory: