Aspect oriented programming and PHP
Today I attended the Expo-C conference in Karlskrona, Sweden. Today was seminar day with a series of sessions on different software architectures. Even though they primarily used Java and .NET rather than PHP or C++ to discuss topics in a more practical a few of the sessions were really good. (Hopefully they’ll learn that better chairs is a must till next years conference.)
Besides Service Orientation I’m especially interested in AOP or Aspect Oriented Programming. I haven’t had the time before to really look into it that deep. I know that we’re kind of using it in integration with proxies that intercept remote calls with Iona Orbix. Of course I started wondering if there are any PHP projects in this area. A quick search came up with a few interesting links concerning PHP…
aoPHP
The project aoPHP is a PHP extension which sounds good. At first glance it looked like it’s using a preprocessor only implemented in Java. When looking more closely there is a PHP only version that you can download and when reading further they plan to release a PHP extension version in June. The latter would be really interesting since I can imagine AOP implemented in PHP with macro expansion and all the stuff needed for it to work could be too slow to be usable.
AOP in PHP 5
The other one was a blog entry by Sebastian Bergmann.
While attending Gunter Kniesel’s “Aspect-Oriented Software Development” lecture yesterday it occured to me that it might be possible to (ab)use PHP 5’s __autoload(), __call(), __get(), and __set() interceptors to facilitate Aspect-Oriented Programming with PHP.
Jackson Miller has written more on aspect oriented PHP using Sebastians ideas.
Update: intercept
After publishing this entry I received an email from Gabriel Ricard. He is working on a PECL extension called intercept that basically allows you to add an interceptor to method calls. It is quite basic right now but he is working on adding chained intercepts, intercepts only on specific objects and more.
What more
Well I can’t find that much on AOP in PHP land. I will definitely give Sebastians ideas a few hours in the next couple of days to see if that is a way to go forward. If you have any other links to projects, ideas or anything concerning aspect oriented programming in PHP please tell me.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.
