[dev] Accessing PEAR server information with PHP
p at rdus.de
p at rdus.de
Sun Nov 13 21:21:43 UTC 2011
The number of PEAR servers has increased dramatically in recent times.
Maybe due to the availability of Pirum[1] - 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[2] 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[3]: The Horde_Pear[4] 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[5].
$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[6].
Links:
------
[1] http://pirum.sensiolabs.org/
[2] http://pear.php.net/package/PEAR
[3] http://www.horde.org/libraries
[4] http://www.horde.org/libraries/Horde_Pear
[5] http://pear.horde.org
[6] http://www.horde.org//libraries/Horde_Pear/docs/REMOTE_PEAR_SERVER
More information about the dev
mailing list