[commits] [Wiki] changed: Doc/Dev/HordePear/REMOTE_PEAR_SERVER

Wiki Guest wikiguest at horde.org
Sun Nov 13 17:26:43 UTC 2011


guest [63.252.205.228]  Sun, 13 Nov 2011 17:26:43 +0000

Modified page: http://wiki.horde.org/Doc/Dev/HordePear/REMOTE_PEAR_SERVER
New Revision:  2
Change log:  Finalize description

@@ -1,55 +1,151 @@
  +Introduction

-The Horde_Pear_Remote class provides you with high-level access to  
the REST interface of a PEAR server.
+The {{Horde_Pear_Remote}} class provides you with high-level access  
to the REST interface of a PEAR server.

-The default instance that will be created when providing no arguments  
to the constructor will allow access to the PEAR server at  
pear.horde.org. This can be easily modified by specifying an alternate  
server name as a first argument.
+Creating an instance of this class without providing any arguments to  
the constructor will allow to access the PEAR server at  
[http://pear.horde.org pear.horde.org].

-An optional second argument allows to specify the underlying access  
helper that converts the REST responses into object instances. Usually  
it should not be necessary to provide this parameter but there are  
examples demonstrating how this can be used further below.
+<code type="php">
+$pear = new Horde_Pear_Remote();
+print(join("\n", $pear->listPackages()));
+
+Horde_ActiveSync
+Horde_Alarm
+Horde_Argv
+Horde_Auth
+Horde_Autoloader
+...
+</code>
+
+This can be easily modified by specifying an alternate server name as  
a first argument:

  <code type="php">
-$remote = new Horde_Pear_Remote();
+$pear = new Horde_Pear_Remote('pear.phpunit.de');
+print(join("\n", $pear->listPackages()));
+
+DbUnit
+File_Iterator
+Object_Freezer
+PHPUnit
+...
  </code>
+
++API overview
+
+The following provides a generic overview of the API provided by  
{{Horde_Pear_Remote}}. A detailed version based on the information  
extracted from the code can be found  
[http://dev.horde.org/api/framework/Pear/ here].

  ++getChannel()

  Returns the channel.xml for the server as string.
+
+<code type="php">
+print($pear->getChannel());
+
+<?xml version="1.0" encoding="UTF-8" ?>
+<channel version="1.0" xmlns="http://pear.php.net/channel-1.0"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:sch\
+emaLocation="http://pear.php.net/channel-1.0  
http://pear.php.net/dtd/channel-1.0.xsd">
+    <name>pear.horde.org</name>
+    <summary>Horde PEAR server</summary>
+    <suggestedalias>horde</suggestedalias>
+    <servers>
+        <primary>
+            <rest>
+                <baseurl type="REST1.0">http://pear.horde.org/rest/</baseurl>
+                <baseurl type="REST1.1">http://pear.horde.org/rest/</baseurl>
+                <baseurl type="REST1.2">http://pear.horde.org/rest/</baseurl>
+                <baseurl type="REST1.3">http://pear.horde.org/rest/</baseurl>
+            </rest>
+        </primary>
+    </servers>
+</channel>
+</code>

  ++listPackages()

  This returns an array with the list of package names. Use this to  
get a quick overview on what is available on the remote server.
+
+<code type="php">
+print(join("\n", $pear->listPackages()));
+
+Horde_ActiveSync
+Horde_Alarm
+Horde_Argv
+Horde_Auth
+Horde_Autoloader
+...
+</code>

  ++getLatestRelease()

  For a given package name this will retrieve the latest version that  
has been released. By default the method only selects stable releases.  
The optional second parameter allows to modify this behaviour to  
specifically return the highest release version of the specified  
stability. If the stability does not matter the argument can be set to  
NULL to retrieve the highest release version independent of the  
stability.
+
+<code type="php">
+print($pear->getLatestRelease('Horde_Core'));
+
+1.7.0
+</code>

  ++getLatestDownloadUri()

  This will deliver the download location for the source archive of  
the latest version that has been released for the specified package.

  The "stability" parameter works in the same way as for the  
getLatestRelease() method above.
+
+<code type="php">
+print($pear->getLatestDownloadUri('Horde_Core'));
+
+http://pear.horde.org/get/Horde_Core-1.7.0.tgz
+</code>

  ++getLatestDetails()

  This will deliver detailed information for the latest release of the  
specified package.

  The "stability" parameter works in the same way as for the  
getLatestRelease() method above.
+
+<code type="php">
+print_r($pear->getLatestDetails('Horde_Core'));
+
+Horde_Pear_Rest_Release Object
+(
+    [_element:protected] => DOMElement Object
+        (
+        )
+
+    [_serialized:protected] =>
+    [_parentElement:protected] =>
+    [_children:protected] =>
+    [_appended:protected] => 1
+)
+</code>

  ++releaseExists()

  Checks if a release exists for the specified combination of package  
name and version number.
+
+<code type="php">
+print($pear->releaseExists('Horde_Core', '1.7.0'));
+
+1
+</code>

  ++getDependencies()

  Returns the dependencies for the specified package version. The  
return value is an array ...?
+
+<code type="php">
+print(count($pear->getDependencies('Horde_Exception', '1.0.0')));
+
+4
+</code>

  ++getPackageXml()

  Returns the package.xml file wrapped as Horde_Pear_Package_Xml instance.

-+Horde_Pear_Rest_Access
+<code type="php">
+print($pear->getPackageXml('Horde_Exception', '1.0.0')->getName());

-This class converts the REST responses into Horde_Pear_* objects that
-simplify access to the data provided by the remote PEAR server.
+Horde_Exception
+</code>

-In most cases you should be able




More information about the commits mailing list