The number of PEAR servers has increased dramatically in recent times. Maybe due to the availability of Pirum - a simple PEAR server. Whatever the cause: there are plenty of package lists and package datasets available on the net these days. Accessing this data is not always easy though.
PEAR servers provide a well defined REST API that is usually queried using the PEAR toolset available via the basic PEAR package. That package however does not provide anything that I would consider to be a decent developers API.
So let me provide you with an alternative that is available via the Horde framework libraries: The Horde_Pear library.
The package comes with the Horde_Pear_Remote class wich provides you with high-level access to the REST interface of a PEAR server.
Creating an instance of this class without providing any arguments to the constructor will allow you to access the PEAR server at pear.horde.org.
$pear = new Horde_Pear_Remote(); print(join("\n", $pear->listPackages())); Horde_ActiveSync Horde_Alarm Horde_Argv Horde_Auth Horde_Autoloader ...
Alternative servers can be specified in the first argument to the constructor:
$pear = new Horde_Pear_Remote('pear.phpunit.de'); print(join("\n", $pear->listPackages())); DbUnit File_Iterator Object_Freezer PHPUnit ...
The full set of the functionality provided by Horde_Pear_Remote is detailed on our website.
No comments:
Post a Comment