The Registry

This information is valid for Horde 3 only. See Doc/Dev/Registry for Horde 4 and later.

Horde's Registry is the glue that holds different applications together.

Things the Registry does when being instantiated:

  1. Importing the global configuration
  2. Setting up the session handler and starting the session
  3. Setting the language and gettext domain
  4. Restoring the registry information from cache or loading and parsing the registry configuration from config/registry.php
  5. Instantiating the global Permission object
  6. Attaching a javascript notification listener

Click here for Registry usage examples. Click here for examples how to use the Registry from outside of Horde.

registry.php

Here's an application's registry.php entry:

$this->applications['whups'] = array(
    'fileroot' => dirname(__FILE__) . '/../whups',
    'webroot' => $this->applications['horde']['webroot'] . '/whups',
    'name' => _("Tickets"),
    'status' => 'active',
    'provides' => 'tickets',
    'menu_parent' => 'devel',
);

fileroot

    'fileroot' => dirname(__FILE__) . '/../whups',

The fileroot setting tells Horde where the application - in this case Whups - lives on the filesystem. The FILE constant is the current file; dirname() strips off the filename and turns it into just a directory.
This means that the location is by default relative to registry.php - under the horde/ directory - which is almost always right. But it's configurable just in case.

webroot

    'webroot' => $this->applications['horde']['webroot'] . '/whups',

The webroot setting tells Horde where the application lives relative to the webserver's document root. Usually this is predictable as well, but you might want to give an application its own domain - for example, http://cvs.php.net/, which is powered by Horde and Chora.

name

    'name' => _("Tickets"),

The name setting surprisingly sets the human-readable name of the application. The _() is an alias for gettext(), which translates the name into other languages.

status

    'status' => 'active',

The status setting tells Horde what kind of application this is. Possible statuses are:

provides

    'provides' => 'tickets',

The provides setting tells Horde if the application provides any APIs. In this case Whups provides the tickets API, which allows for adding and listing tickets. In turn, Horde knows that if it gets a request for a tickets/search method, it should pass it along to Whups.

menu_parent

    'menu_parent' => 'devel',

The menu_parent setting is just for the sidebar - it tells Horde what item to make the application of a child of. This lets you customize the menu to your heart's content. This can be left out or set to null for top-level items.