[dev] Correct method for inter-application calls

Jason M. Felice jfelice at cronosys.com
Tue Jun 3 15:41:13 PDT 2003


On Tue, Jun 03, 2003 at 03:49:33PM -0600, Diego Rivera wrote:
> Hello all!
> 
> I'm writing some integration stuff that may require interoperation
> between Kronolith, Imp, Moment, Nag and Turba, and I'm wondering what
> the correct mechanism to follow would be to call a function exported in
> - say - IMP's api.php from a method within a Turba backend driver, or
> within turba itself.
> 
> I'm reluctant to start doing includes and requires all over the place,
> so if there's a horde-standard way of doing this I'd much prefer that
> (a-la Horde::callAppApi('imp', '_api_call', arg1, arg2, ... , argN ) ).
> 
> I looked at Horde.php and horde's api.php in search of what I would be
> needing (or something close) and came up empty except for listApis()
> which I don't think is what I want.
> 

I just found this stuff myself ;-)  Look in lib/Registry.php.  You want
to do something like this:

global $registry;
if ($registry->hasMethod('projects/get_assigned_ticket_ids')) {
	$result = $registry->call('projects/get_assigned_ticket_ids');
}

The 'projects/' is from the 'provides =>' line for that app in
config/registry.php, the `get_assigned_ticket_ids' is the name registered
in that applications api.php.

Sample code can be found in kronolith, which gets events from all over the
place.

What sort of integration?  I'm planning a bit myself (imp/whups/nag/hermes).

-Jay 'Eraserhead' Felice


More information about the dev mailing list