6.0.0-git
2024-12-02
Last Modified 2017-10-03 by Jan Schneider

Horde Framework Module

The Horde Framework modules, also known as Horde Libraries, are an integral part of the Horde Application Framework. These modules are managed in our Git repositories and can be downloaded either from our PEAR server or from Github directly. 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 as PEAR and Composer packages.

Installation

Most of these methods require that you first tell your PEAR installation about the Horde PEAR channel:

pear channel-discover pear.horde.org

Installing everything from Git

You should use the Horde Git Tools to download and install multiple libraries or the whole framework at once.

Installing individual libraries from Git

You can checkout and install individual packages directly from GitHub or with the Horde Git Tools like above. For example, to install the Horde_Compress package, in the Compress directory, you would run:

pear install Compress/package.xml

Installing from https://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:

pear install horde/Horde_Compress

To view the available packages, their states (alpha, beta, stable), dependencies, and other information about them, visit https://pear.horde.org.

If you already have a Horde release

Horde releases come with all of the required framework libraries installed, and also include the necessary code to make everything available to Horde without any further installation or PHP configuration.

Use

If PHP has been set up properly, the local PEAR repository should be in PHP's include_path. If installing the Horde Libraries either separately with the PEAR installer or using the Horde Git Tools, they are available alongside PEAR's packages, and can be included in your custom code the same way:

// Include PEAR's DB package.
require_once 'DB.php';
// Include PEAR's Text_Wiki package.
require_once 'Text/Wiki.php';
// Include Horde's Horde_Tree package.
require_once 'Horde/Tree.php';
// Include Horde's Horde_Text_Flowed package.
require_once 'Horde/Text/Flowed.php';

If using the Horde environment, these require_once statements are not needed as the libraries will be autoloaded the first time they are used.

Development

Git organization

All libraries are managed in GitHub. Each library has its own subdirectory. The library package names are ALWAYS Horde_<Name>, and the directory names are <Name>.

Each package directory contains a package.xml file with package descriptions, file listings, dependencies, change logs etc. As all Horde Libraries are following the PEAR standard, they can be installed using the PEAR installer or may be symlinked to a subdirectory of the Horde installation. For further instructions, see the Installation Instructions located above.

Directory structure

Name/
    package.xml
    lib/
        Horde/
            Name.php
            Name/
                foo.php
                bar.php
...

After installation:

lib/
    Horde/
        Name.php
        Name/
            foo.php
            bar.php
...

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