Horde: first signs of a COM for PHP

From JanComments API available;

Using this API every Horde application can now add threaded discussions to any objects.

Finally! A forum engine you can integrate with your own applications. I assume “every Horde application” means code using the Horde Framework or at least adapting to it.

Think this is a first in PHP. There are projects (beginning with PHP Nuke) which pack multiple apps but in a “all or nothing” kind of form, tightly integrated across multiple layers. What seems to differentiate this approach is you have effectively stand-alone applications which you can tap into as you need from your own code (as you can with Windows Apps).

A little background (from patchy second-hand knowledge). The Horde is one of the (if not the most) mature frameworks / collection of applications written in PHP, going back more that five years I believe. If you’ve been around PHP for a while, you may recognise some of the contributors from other places like PECL and PEAR. At the same time Horde is one of the dark horses of PHP; despite the age of the project, suspect there’s not much awareness they’re doing in PHP circles aside from those that know.

Probably the most well known Horde “deliverable” is IMP, a web based email client. You’ve probably also seen Chora in action at cvs.php.net. Looking at the project list it contains pretty much every type of common web application out there.

Which is why I get excited about Jan’s annoucement – what he’s saying looks alot like Windows COM to me – a mechanism to expose APIs from their existing applications to new applications, making useful integration a possibility.

I’m not familiar with the Horde code base (for no reason other than time, have never stopped to give it a serious look) aside from Horde offshoots (if that’s fair to say?) like PEAR::Log. There does seem to be a decent respect for seperation to the point where exposing APIs in this way is possible.

Also surprised to see ASP.NET-like markup in templates although nervous when looking at the template implemenation which seems to re-parse templates on each request.

Would be interested to hear other peoples experiences with the Horde framework.

Also wonder about the concept of a Registry, from the perspective of “does this mean a centralized configuration repository?”. There’s a good point here to that effect;

Registries are property databases used by both Windows itself and applications. Each registry lives in one big file. Registries contain a mix of text and binary data that requires specialized editing tools. The one-big-file approach leads, among other things, to the notorious

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • http://www.dvd-software.info hurricane_sh

    There is a basic difference, COM is binary code. PHP may be not suitable for complicated system, although it’s object-oriented, as a pure script language, it doesn’t compile the source. Java is the right way to go.

  • andre

    so what if PHP does not compile the source. java servlets aren’t superior in all web applications. there are stuff where java is better and there are stuff where php is better or simpler.

    besides there are freeware and commercial add-ons to PHP to somewhat mitigate what you cited and further increase performance.

  • http://www.phppatterns.com HarryF

    PHP may be not suitable for complicated system, although it’s object-oriented, as a pure script language, it doesn’t compile the source.

    Think the active word the is “may” and right now it’s premature optimization.

    This is just the first step, allowing integration of Horde’s forum with other apps. Think long before performance becomes a serious concern with this approach we’ll probably see PHP on Parrot or some form of specializing compiler.

    Java is the right way to go.

    The “right way” is relative.

  • ausurt

    Essentially, what this boils down to is having a generic library of applications that can be used in different situations?

    Although not completely free of its designers constraints, it can be modified in a day or two to suit your needs.

    Working on a framework myself and then moving onto the CMS, im trying to implement a bunch of grouped classes that meet a specific need, such as templating, caching, logging, DB abstraction, that way I can use whichever mix, whenever. What we really need is a standard library API specification so I can plug in any caching mechanisam, any logging mechanism, without worrying about modifying too much of the code. With our framework/CMS we will supply a few guidelines as to specify what parts should be called what.

    As for the CMS it is just a bunch of classes dumped on top that allow sites to have content.

  • http://www.dvd-software.info hurricane_sh

    Don’t get me wrong, guys, I didn’t meant to say Java is the best solution for everything. PHP is simpler and faster, best choice for those websites without complicated business logic, but it’s born for page representation, if you want to make a two-tier PHP system – separate the logic and UI, or make some ready to use big modules, not problem, you can do that, but you just misused it.
    Language is just a tool, use them in the right place with the right way.

  • http://www.phppatterns.com HarryF

    born for page representation

    That is a fair point. It just never stops there ;) Gonna keep it short as I feel a long discussion brewing…

  • ausurt

    A bit off topic here, but has anyone heard about the PHP5 Java extension, is it true Sun are lending a hand, or has it just been abandoned?

    On topic. I think PHP is a great language, especially version 5, but it is missing a few features that would make it a better one.

  • Hugh

    Why not use phpBB2 or any other great Forum application already in place ??
    Check you what the PAS (Application Server for PHP) guys did: http://sqlfusion.org/ with a minimal system you can merge and integrate in your application any existing PHP application.
    All that smoothly with a nice Package management application.

  • http://www.phppatterns.com HarryF

    A bit off topic here, but has anyone heard about the PHP5 Java extension, is it true Sun are lending a hand, or has it just been abandoned?

    Haven’t heard that Sun is actually working on the PHP / Java extension (and doubt they will). There is JSR 223 but my guess would be SOAP will be the glue, hence this: http://www.php.net/soap

    Why not use phpBB2 or any other great Forum application already in place ??

    I’ve looked at many and the problem is always they implement the “whole stack” – sessions, user auth, templating etc – means alot of modification. Will check out PAS though – looks interesting.

  • Dorsey

    One of the underlying purposes of COM, and its major reason for existence, is that it is platform- and language-independent, thus COM objects are usable by programs written in C (with great difficulty), C++, Java, VB, Pascal(!), et al.

    If and when a PHP module can do that using the COM mechanisms, it will conform to COM. Otherwise, the concept referenced here is “COM-like”. No, I don’t work for Microsoft.

  • http://www.japan-website.com/ pavan_patil

    I can see, the problem is with the category_parents data – the
    line in question is referring to $cids[$parID], and the data int he mySQL
    table points to an index that doesn’t exist in the cids array.

    The problem is generated from the import function within
    /horde/lib/Category.php

    If there is any more info you all need to help me troubleshoot, just ask and
    I’ll be glad to provide it.

    Oh, one other thing – the horde.log doesn’t show anything relevant to the
    problem, and I pass all the tests on “test.php”, except for one error to do
    with File.php (within pear) that I’ve been told on IRC to ignore. Anywaits,
    file.php can’t have anything to do with categories now, can it? ;)

    Registry Easy