Event driven programming in PHP - Conclusion about Events





Download the demo code

Throughout the writing of this article it became very clear to me that a full implementation of events in PHP, would require some kind of abstraction layer. Once that is in place, it will become viable to go this route (depending on your needs).

Which would fit nicely into a PHP framework - apparently there are a few out there supporting events.

It is however more fun to build your own (for me in anycase), which would force an initial investment of time (which we might not have). There would also be a lot more things to consider, I barely scraped the surface.

Think about events in a class inheritance scenario.
Think about maintaining page state (something I briefly mentioned in the "Reconcile GUI events" section.
Think about creating a multitude of controls, representing html controls.

If you're simply needing it for what I discussed in the "Building flexible controls" section, you might get away without needing a full implementation.

All in all, the biggest thing is looking at your task at hand, what you really need. You might end up trying to wack an ant with a nuclear bomb.



Comments

Good article





Post comment

Name *
Email
Title
Body *
Security code
*
* Required fields

Latest Articles

Top 5 Articles

Programming humor


Collection of funny programming articles
2006-10-08 14:23:43

How to create your own RSS Reader


It is very simple creating your own rss reader, the following article looks at a few methods of doing this.
2008-06-23 13:18:25

Javascript Reference: Dropdown


A quick reference about working with dropdown boxes (select element) in javascript.
2007-02-17 16:36:41

PHP: Snippets


Collection of PHP snippets
2010-05-22 00:06:45

Event driven programming in PHP


An article looking at adding some kind of event driven model to PHP 5
2008-07-28 12:48:09