Application Programming Interface

I was just thinking how nice it would be if more open-source PHP applications offer some sort of API for their application. It would really be useful specially when the application is likely to be integrated with another.

For example, I have phpBB2 and Coppermine Gallery. Yes, there's already a Coppermine-phpBB bridge to tie the forum users to the gallery. But other than that, I have no other means of communication between the two. What if I want to display a link to a user's gallery in each of his post, along with the usual buttons (profile, ims, etc)? What if I wanted to display randomly picked images from a user's gallery and display it in his/her profile?

Ways of accessing an application's functionalities from outside might range from a simple, block copy-paste solution and/or directly talking at another's DB tables... to hellish insert-here-to-there hacks and conflicting variable hunts that span several files. Some people would find themselves reading and studying in detail how both applications to come up with a way to make them work together. In-depth knowledge is good. But sometimes you don't have for that and might be an overkill in some cases. I don't want to see how that cow got in there, I just want my hamburger.

If both had an available API, I don't have to go through all that trouble. I would already know what it could do and know how to make it do things without dealing with unrelated stuff. And if I ever have to make it do something out of the ordinary, I will know where to look at.

Plugins just crossed my mind (it should... I'm using WordPress). Some apps come with their own plugin system, so you can extend the application and often times import some functionalities from outside the application... kinda like what an API does. But I don't think they can replace APIs. In fact, they need APIs to exist. The application provides a some sort of a Plugin API for building plugins. Hmmm... using Plugin APIs to build a plugin that communicates to another application via the API the other app provides. Sweet. I don't have to deal with how the inside works. I just need something to connect them from the outside.

By the way, if anyone reading this knows some open-source projects (in PHP) that have an API available, please do comment. Already found one, SMF, a forum software. The API is just in its pre-release though, but sure looks promising.

I'm sleepy and could no longer think clearly. I hope I made some sense in this post.



No comments so far.

Leave a Reply

(will not be published)