Event-driven MVC in ZF – a good match?

zf2_logoI’ve been working with ZF2 some the past several weeks, and have to say it’s a bit odder than I expected.  Beyond the verbosity of the standard directory layouts (“/modules/Foo/src/Foo/Controller/BarController.php”?  really? “views” not being under “src” by default bugs me too…), the ‘event’ system seems to be the preferred way of dealing with things these days.

However, we’re shoving “event-based” architecture with a more traditional web-MVC approach, and it doesn’t *feel* like this is going to be a good marriage.  I may be wrong, of course, and obviously things “work”, as in I can make a request and get a response. It is probably that ZF2 is simply a bit too new still – I’m not seeing a lot of good examples of “best practices” to follow, nor am I seeing a concise list of framework-provided events (googling for “Zf2 core events” wasn’t useful, for example).

Personally, I’ve tended to associate “event driven” with languages and platforms that were long-lived – being able to signal an event to something that was running in memory for hours or days, knowing it would be there after the current request had gone – makes more sense.  Event-driven in a language like PHP feels wrong, although I realize it’s in the context of ZF specifically, not the PHP language.

So…wWhat resources should I be looking at for ‘best practices’, and good examples of using event-driven thinking in MVC?


I'm currently working on a book for web freelancers, covering everything you need to know to get started or just get better. Want to stay updated? Sign up for my mailing list to get updates when the book is ready to be released!

Web Developer Freelancing Handbook

Share and Enjoy:
  • del.icio.us
  • DZone
  • Facebook
  • Reddit
  • StumbleUpon
  • Digg
  • Simpy
  • Technorati

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">



0.17583680152893