Application Building With Horde
Chuck Hagenbuch
I thought Horde was just ...
- Webmail?
- Groupware?
- A blue design with a sidebar?
"What is Horde?"
- The Horde Project: an open source project driven by:
- The Horde Developers: volunteer developers providing:
- The Horde Application Framework: a PHP web application framework, consisting of:
- The Horde Libraries: PEAR-style packages powering:
- The Horde Applications: real-world integrated web applications
Why: Libraries
- Over 60 high quality PHP libraries in PEAR packages
- PHP4 and PHP5
- Authentication and Permissions to MIME handling to user preferences to XML transformations
- Coding standards that were the basis for the PEAR coding standards
- Initial PEAR packages including Log and Mail were contributed from Horde to PEAR
Why: Standards
- XHTML/CSS Layout
- Comprehensive MIME standards support
- Groupware apps all handle iCalendar and vCard
- SOAP and XML-RPC access to all application APIs
- SyncML server
- WebDAV server
Why: Backend Independence
- SQL drivers work for MySQL, PostgreSQL, Oracle, MSSQL, more
- LDAP support for contacts, preferences, users, more.
- VFS (virtual filesystem) support for local files, SQL, FTP, more
- Pluggable drivers for all backends
Why: Applications
- Over 50 in CVS
- Used by MIT, Portugal Telecom, and many many more
- Groupware apps are all in at least 2nd major release
- All applications integrate users and their data
- Developer tools including Chora and Whups
- Access to APIs without tight coupling
Why: Internationalization
- Full Unicode support in IMP and most apps
- Standards-compliant character set handling
- 39 different translations
Why: The Project
- Incredibly feature-rich
- Built through more than eight years of development ...
- ... of real-world production web applications
- Constantly updated, improved, innovated, and refactored
Application Building
All of these applications, APIs, libraries, etc. are why you can
build any kind of application or site with Horde.
What makes a Horde application?
Typically Horde applications share a common structure and code
organization. The skeleton application
provides this for you.

What makes..., cont.
But all you really need is:
- An entry in
horde/config/registry.php
That's all?
Technically, yes. But to take full advantage of Horde, you'll also want:
- A
config/
directory with at least conf.xml
and prefs.php
files
- A
lib/api.php
file describing your app's API
- A
locale/
directory for translations
- A
themes/
directory for styles and graphics
registry.php
Here's an application's registry.php entry:
Building our catalog applications
- Rdo: lightweight, PDO-based ORM
- Automatic generation of Model classes
- Override with customized Model
- Automatic generation of Horde_Forms from Model
Getting started
Introduction to Rdo
- ORM - Object-Relational Mapping
- Uses PDO drivers
- Use of PHP 5 interfaces - Iterator, IteratorAggregate, ArrayAccess, Countable, etc.
- Beta
- (... though so is Gmail)
Rdo Example Usage
Rdo: Creating & Editing
Rdo: More Find & Delete
Form Generation
Introduction to Horde_Form
- Over 40 validating field types
- Can be created programmatically or automatically from Horde_Form_Helper
- Full server-side validation
- Javascript helpers for many tasks (date picker, color picker, et. al.)
Horde_Rdo_Lens
Motivation: How many times do I have to loop through this #*)&%% array?
Remember Flyweight?
http://en.wikipedia.org/wiki/Flyweight_pattern
Flyweight is a software design pattern. When many objects must be
manipulated and these cannot afford to have extraneous data,
flyweight is appropriate.
In the flyweight pattern, the data has no pointers to the data
type methods, because these would consume too much space. Instead,
the subroutines are called directly. In some cases, flyweight
inheritance is performed by "shift-in" and
"shift-out" data markers as a higher-level operation
cycles through an array of flyweight data.
One classic example of a flyweight pattern are the characters
stored in a word processor. Each character represents an object that
has a font face, font size, and other formatting data. As you can
imagine, a large document with this data structure would bloat the
memory footprint of the word processor. Moreover, since much of this
data is repeated, there must be a way to reduce the footprint - the
Flyweight pattern. Each of the character objects would contain a
reference to a separate formatting object which contains the
required properties. This greatly reduces the memory footprint by
combining all of the like-formatted characters into simpler objects
that reference a single formatting object.
Lens use
Doing more with our data
Let's provide a different way to see the packages we're
expecting. How about WebDAV?
WebDAV browsing made simple

Obrowser, where art thou?
Alternate ways to see what WebDAV sees:

Obrowser, cont.

Obrowser, cont.

Implementing /browse
- This is the API method that implements both WebDAV and obrowser functionality
- Takes a path and an optional list of property names
- Returns an array depending on the path
- Code
Questions?