Last Modified 2012-05-31 by Gunnar Wrobel

Creating a Horde Module

Please follow the instructions below and choose the version for which you'd like to start a new module. Once you have your first module you need to populate it with content. This will be the subject of the next section: PopulatingYourFirstModule

Horde 5

1. Check out the Horde 5 git branch (at the time of writing Horde 5 resides in the "develop" branch):

 git clone --depth 1 -b develop git://github.com/horde/horde.git
 cd horde

2. Start a new module - based on the Skeleton module - by running the following helper script:

framework/devtools/horde-generate-module.php newmodulename "Me Myself <me@myselfandi.com>"

The new module will end up in the git repository and have the name "newmodulename".

3. Link or copy the new module into your horde installation.

 ln -s `pwd`/newmodulename /your/install/path/to/horde/

Linking is the preferred variant as this allows you to work within the horde git repository and commit any code you write to a local branch. At the same time you have the installation ready for immediate testing of any changes.

4. In /path/to/horde/config/registry.d/ create a file called newmodulename.php. Please note the lack of ?> at the end of the php block, and also the menu parent. If you want your object to go *ANYWHERE ELSE* you will need to change this!

This is a "registry.d" example for Horde 5:

$this->applications['newmodulename'] = array(
        'name' => _("New Module"),
        // This is sufficient. More options possible if needed

5. If you wish you can provide your new module with a PNG icon at 16x16. This needs to be placed in the "themes" subdirectory:

mkdir newmodulename/themes/default/graphics
cp newmodulename.png newmodulename/themes/default/graphics/

This one is an example PNG from the basic horde application


Horde 4

1. Check out the skeleton module from horde git

 git clone --depth 1 git://github.com/horde/horde.git
 cd horde
 cp -R skeleton/ /your/install/path/to/horde/

2. Create the following script as projectrename.php - save it somewhere sensible, like your home directory:

#!/usr/bin/php -q
function analysedir( $path_, $list_ )
  // Read dir
  $handle = opendir($path_);
  while (false !== ($file = readdir($handle)))
    if( $file!='.' && $file!='..')
        $file = $path_ . DIRECTORY_SEPARATOR . $file;
        //echo "$filen";

        if( !is_dir( $file ) )  // If File: Append
        else   // If Folder: scan recursively
          $list_ += analysedir($file, $list_ );
 }      // While END
 return $list_;

function substitute_skeleton( $filename, $modulname )
  $prjMC=substr($prjUC, 0, 1) . substr($prjLC, 1, strlen($prjLC)-1);

  $filehandle=fopen(trim($filename), 'r');
  $file=fread($filehandle, filesize($filename));
  $newfile=str_replace(array('SKELETON', 'Skeleton', 'skeleton'), array($prjUC, $prjMC, $prjLC), $file);
  $filehandle=fopen(trim($filename), 'w');
  fwrite($filehandle, $newfile);

function help()
  echo "projectrename.php </path/to/skeleton-folder/> <modulname>n";

// ------------------- Main-Code --------------------

if (count($_SERVER['argv'])==3)
  // Preparation
  $list = array();
  $path = trim($_SERVER['argv'][1]);
  $modul = trim($_SERVER['argv'][2]);

  // Fetch Filelist
  $list = analysedir( $path, $list );

  // Modify each File
  foreach( $list as $file )
        //echo $modul.": ".$file."n";
        substitute_skeleton( $file, $modul );

3. On a unix system, use the following command to replace all skeleton strings with your project name (Not tested on Windows, but should work):

projectrename.php /path/to/skeleton modulname


Edit your Name into all files, for example with this snippet under bash (Unix, Linux or Windows with cygwin):

find ./ -type f -exec sed -i 's/Your Name <you@example.com>/Me Myself <me@myselfandi.com>/g' {} \;

3.2 Rename

mv horde/appname/test/Skeleton horde/appname/test/Appname

mv horde/appname/locale/skeleton.pot horde/appname/locale/appname.pot

4. Perform some file modifications:

mkdir /path/to/modulename/themes/graphics

5. Upload a PNG icon at 16x16 for the module to the path created above. This one is an example from the basic horde application:


6. In /path/to/horde/config/registry.d/ create a file called modulename.php. Please note the lack of ?> at the end of the php block, and also the menu parent. If you want your object to go *ANYWHERE ELSE* you will need to change this!

This is a registry.d example for Horde 4:

$this->applications['tickplug'] = array(
        'name' => _("Tickplug"),
        'provides' => array(
        // This is sufficient. More options possible if needed

Horde 3

It is not recommended to use the Horde 3 Skeleton from CVS any longer. There is currently no usable version of Skeleton which is tagged FRAMEWORK_3. An older revision of the CVS HEAD version may work though.

This is a registry.d example for Horde 3:

$this->applications['modulename'] = array(
    'fileroot' => dirname(__FILE__) . '/../../modulename',
    'webroot' => $this->applications['horde']['webroot'] . '/modulename',
    'name' => _("A description of your module"),
    'status' => 'active',
    'menu_parent' => 'horde'