SourceForge.net Logo

A PHP5 pluggable framework based on the POSA2 interceptor design pattern


The POSA2 interceptor design pattern by Schmidt et. al allows us to plug in extra functionality in a framework using predefined hooks. The original implementation is programmed in C++ and can also be easily done in Java. With the growing popularity of dynamic typed scripting languages like PHP5, it is interesting to see if such languages are mature enough to implement complex design patterns from the object-oriented world. The goal of this paper is twofold; first of all demonstrate how the interceptor pattern works, but also to test PHP5's new object-oriented support. I want to show that we can build complex applications using the former "toy" scripting language. Several language specific issues are taken in account, like the lack of language built-in support for events in PHP5, dynamic typing, etc. To make the framework more dynamic (and interesting), I implemented the implicit interceptor pattern variant, which frees developers from the burden of explicitly registering the plug-ins.

You can download the paper in pdf or you can view it in html (it's generated from a word document).

The code can be downloaded from the SourceForge project site: https://sourceforge.net/projects/phpinterceptor/

Lee Provoost
Software Technology Group
Department of Information and Computing Sciences
University of Utrecht, P.O. Box 80089 3508 TB, Utrecht, The Netherlands
{l.provoost} @students.uu.nl
http://blogs.webcoder.be/lee