\documentclass{article}
\usepackage{ulem}
\pagestyle{headings}
\begin{document}
\tableofcontents

\part{ Horde Framework Module}
The \textsl{Horde Framework} modules, also known as \textsl{Horde Libraries}, are an integral part of the \textsl{Horde Application Framework}. These modules are managed separately\footnote{http://cvs.horde.org/framework/} in our CVS repository\footnote{http://www.horde.org/source/} but are included with the Horde packages\footnote{http://www.horde.org/horde/download/} that can be downloaded from our FTP servers\footnote{http://www.horde.org/mirrors.php}. The modules are general purpose libraries that are being used by several Horde applications or the framework itself, but can also be utilized outside the Framework in custom PHP solutions. They are developed, packaged, and distributed similarly to the PEAR packages\footnote{http://pear.php.net/}.

\section{ Installation}
Most of these methods require that you first tell your PEAR installation about the Horde PEAR channel:

\begin{verbatim}
pear channel-discover pear.horde.org
\end{verbatim}

\subsection{ Installing everything from CVS}
You will need the entire Horde Framework module. You can either get a CVS checkout of the \texttt{framework} module from Horde's anonymous CVS server (see http://horde.org/source/\footnote{http://horde.org/source/} for instructions on using CVS), or you can download a nightly snapshot from http://snaps.horde.org/\footnote{http://snaps.horde.org/}. You'll want the latest framework-HEAD snapshot.

 Once you have the full framework you have two options: symlinking, or installing with the PEAR installer. If you want to install with the PEAR installer, there is an \texttt{install-packages.php} script (or, if using Windows, an \texttt{install-packages.bat} script) in the framework/ directory that will automate the process for you. Simply run:

\begin{verbatim}
php install-packages.php
\end{verbatim}

from the framework directory. The major disadvantage of this method is that if you are using CVS, you will need to re-run the script every time you update. If you are doing Horde development or update from CVS frequently, then using symlinks is recommended.

To create a symlinked framework installation automatically, you will first need to install the Horde devtools package:

\begin{verbatim}
pear install devtools/package.xml
\end{verbatim}

If this succeeds you will now have some development tools in your PATH, including \texttt{horde-fw-symlinks.php}. This script accepts a framework directory and a target directory as options:

\begin{verbatim}
$ horde-fw-symlinks.php --help
Usage: horde-fw-symlinks.php [OPTION]

Possible options:
  --copy        Do not create symbolic links, but actually copy the libraries
                (this is done automatically on Windows).
  --src DIR     The source directory for the framework libraries.
  --dest DIR    The destination directory for the framework libraries.
  --pkg DIR     Path to a single package to install.
\end{verbatim}

The default is to run the script from your main Horde directory, with \texttt{framework/} as the source directory and a \texttt{libs} directory as the target (these values are assumed if you don't specify --src or --dest). You will see a processing message for each package, and then all you need to do is to add the \texttt{libs/} directory to your include\_path.

Symlinking is useful for developers who develop on the framework libraries and want to see their changes in real-time without having to re-install the affected package. This script is also used to distribute the libraries with the Horde packages.

\subsection{ Installing individual libraries from CVS}
You will still need a full checkout or a snapshot of the framework, as above. Then you can install individual packages. For example, to install the Horde\_Compress package, in the \texttt{framework/Compress} directory, you would run:

\begin{verbatim}
pear install Compress/package.xml
\end{verbatim}

\subsection{ Installing from http://pear.horde.org/\footnote{http://pear.horde.org/}}
Installing from pear.horde.org is simple. Once you have "discovered" the channel as described above, you can install Horde packages just like other PEAR packages. For example to install the Compress package:

\begin{verbatim}
pear install horde/Horde_Compress-alpha
\end{verbatim}

(the -alpha is necessary if you have not configured PEAR to install alpha state packages by default. This will vary depending on the Horde package that you pick; some are stable, some are beta, and some are alpha.)

To view the available packages, their states (alpha, beta, stable), dependencies, and other information about them, visit http://pear.horde.org/index.php?category=framework\footnote{http://pear.horde.org/index.php?category=framework}.

\subsection{ If you already have a Horde release}
Horde releases come with all of the framework libraries bundled in the \texttt{horde/lib/} directory, and also include the necessary code to make everything in the \texttt{horde/lib/} directory available to Horde without any further installation or PHP configuration:

\begin{verbatim}

ini_set('include_path', dirname(__FILE__) . PATH_SEPARATOR . ini_get('include_path'));
\end{verbatim}

This code prepends the \texttt{horde/lib/} directory to the existing \texttt{include\_path}. For example, if the \texttt{include\_path} is set to \texttt{.:/usr/share/php} in \texttt{php.ini}, it will become \texttt{/path/to/horde/lib:.:/usr/share/php}. This means that library files included with \texttt{include}, \texttt{include\_once}, \texttt{require}, or \texttt{require\_once} statements are first looked for in Horde's \texttt{lib/} directory, then in the local directory (\texttt{.}), and finally in the PEAR repository. The side effect is that libraries that come with Horde and have the same name like a PEAR package, e.g. File\_CSV, are used in favor of the PEAR package.

\section{ Use}
If PHP has been set up properly, the local PEAR repository should be in PHP's \texttt{include\_path\footnote{http://www.php.net/manual/en/ini.core.php\#ini.include-path}}. If installing the Horde Libraries either separately with the PEAR installer or using \texttt{install-packages.php}, they are available alongside PEAR's packages, and can be included in your custom code the same way:

\begin{verbatim}

// Include PEAR's DB package.
require_once 'DB.php';
// Include PEAR's Text_Wiki package.
require_once 'Text/Wiki.php';
// Include Horde's VFS package.
require_once 'VFS.php';
// Include Horde's Horde_Tree package.
require_once 'Horde/Tree.php';
// Include Horde's Text_Flowed package.
require_once 'Text/Flowed.php';
\end{verbatim}

\section{ Development}
\subsection{ CVS organization}
All libraries are managed in the \texttt{framework} CVS module\footnote{http://cvs.horde.org/framework/}. Each library has its own subdirectory inside the framework module. The directory names are unfortunately a bit inconsistent and match not always the library name exactly. The \texttt{Util/} directory for example contains the \texttt{Horde\_Util} package.

The following quote from the PEAR manual\footnote{http://pear.php.net/manual/} explains the package name format:\newline
\begin{quote}
One of the most important tasks while contributing a new package to PEAR is finding an appropriate name for your package.The general syntax for package names is \texttt{<Category>\_<Name>}. The value for \texttt{<Category>} should be chosen from a predefined list of categories that are available in PEAR (e.g. "HTTP", "Net", "HTML"). The second part is the name of the package (like "Upload", "Portscan", "Table").\newline
\end{quote}

\newline
Each package directory contains a package.xml\footnote{http://pear.php.net/manual/en/developers.packagedef.php} file with package descriptions, file listings, dependencies, change logs etc. As all Horde Libraries are following the PEAR\footnote{http://pear.php.net} standard, they can be installed using the PEAR installer\footnote{http://pear.php.net/manual/en/installation.cli.php} or may be symlinked to a subdirectory of the Horde installation.  For further instructions, see the Installation Instructions located above.\subsection{ Directory structure}
The \texttt{VFS} package has the following structure in CVS:\newline
\begin{verbatim}

framework/VFS/
    package.xml
    VFS.php
    VFS/
        file.php
        ftp.php
...
\end{verbatim}

and is installed like so in the PEAR repository or the \texttt{lib/} directory, which is exactly the same:\newline
\begin{verbatim}

lib/
    VFS.php
    VFS/
        file.php
        ftp.php
...
\end{verbatim}

But this is different with the \texttt{Horde\_Tree} package. In CVS:\newline
\begin{verbatim}

framework/Tree/
    package.xml
    Tree.php
    Tree/
        javascript.php
        html.php
...
\end{verbatim}

After installation:\newline
\begin{verbatim}

lib/
    Horde/
        Tree.php
        Tree/
            javascript.php
            html.php
...
\end{verbatim}

A rule of thumb is that each underscore in a package name is translated to an additional directory after installation.

\end{document}
