> -----Original Message-----
> From: Eric Butera [mailto:eric.but...@gmail.com]
> Sent: Friday, May 20, 2011 2:25 PM
> To: PHP
> Subject: Re: [PHP] observer pattern
> [whoops didn't hit reply-all]
> On Wed, May 18, 2011 at 5:18 AM, Ken Guest <k...@linux.ie> wrote:
> > Lo,
> >
> > so, I'm wondering - how many of you use the observer pattern in php;
> > and if so, do you implement it 'standalone' or with the spl classes?
> > Is there any particular advantage to doing it "your way"; whichever
> > your way is?
> >
> > Ken
> >
> > --
> > http://blogs.linux.ie/kenguest/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> I use it quite a bit over the various projects I maintain.  It allows
> subjects to trigger events that observers can process if they're
> interested, or better yet, completely ignore.  This allows
> standardized code bases to create nice hooks that allow extensibility
> without needing to place one-off code inside the main project.
> A quick example might be on saving a record in your code, it triggers
> an event, then an observer in a custom site watches for said event and
> injects/updates a search entry in Lucene.  This way one site can have
> a custom search engine that another site might not need.
> I started off with the concepts I found in
> http://examples.stubbles.net/docroot/events/ but created my own
> because I wanted something stand-alone.

Well, you (or in this case, *I*) learn something new every day.

I had no idea PHP could do observers. How very "Java" (and neat!) 
Granted, it is just a design pattern, but to have the SplObserver stuff built 
in is pretty cool.
What version of PHP is this available from? The web page doesn't say.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to