\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
+Introduction

The \texttt{Horde\_Pear\_Remote} class 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 to access the PEAR server at <a href="http://pear.horde.org">pear.horde.org</a>.

<pre><code class="language-php">
\$pear = new Horde\_Pear\_Remote();
print(join("\textbackslash\{\}n", \$pear->listPackages()));

Horde\_ActiveSync
Horde\_Alarm
Horde\_Argv
Horde\_Auth
Horde\_Autoloader
...
</code></pre>
This can be easily modified by specifying an alternate server name as a first argument:

<pre><code class="language-php">
\$pear = new Horde\_Pear\_Remote('pear.phpunit.de');
print(join("\textbackslash\{\}n", \$pear->listPackages()));

DbUnit
File\_Iterator
Object\_Freezer
PHPUnit
...
</code></pre>
+API overview

The following provides a generic overview of the API provided by \texttt{Horde\_Pear\_Remote}. A detailed version based on the information extracted from the code can be found <a href="http://dev.horde.org/api/framework/Pear/">here</a>.

++getChannel()

Returns the channel.xml for the server as string.

<pre><code class="language-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\textbackslash\{\}
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></pre>
++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.

<pre><code class="language-php">
print(join("\textbackslash\{\}n", \$pear->listPackages()));

Horde\_ActiveSync
Horde\_Alarm
Horde\_Argv
Horde\_Auth
Horde\_Autoloader
...
</code></pre>
++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.

<pre><code class="language-php">
print(\$pear->getLatestRelease('Horde\_Core'));

1.7.0
</code></pre>
++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.

<pre><code class="language-php">
print(\$pear->getLatestDownloadUri('Horde\_Core'));

http://pear.horde.org/get/Horde\_Core-1.7.0.tgz
</code></pre>
++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.

<pre><code class="language-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></pre>
++releaseExists()

Checks if a release exists for the specified combination of package name and version number.

<pre><code class="language-php">
print(\$pear->releaseExists('Horde\_Core', '1.7.0'));

1
</code></pre>
++getDependencies()

Returns the dependencies for the specified package version. The return value is an array ...?

<pre><code class="language-php">
print(count(\$pear->getDependencies('Horde\_Exception', '1.0.0')));

4
</code></pre>
++getPackageXml()

Returns the package.xml file wrapped as Horde\_Pear\_Package\_Xml instance.

<pre><code class="language-php">
print(\$pear->getPackageXml('Horde\_Exception', '1.0.0')->getName());

Horde\_Exception
</code></pre>
\end{document}
