I need to integrate an event dispatcher in my own codebase (custom PHP library), so I looked at what both Symfony2 and Zend Framework 2 are doing.
Obviously, there's no shared interface for dispatching events, because both frameworks have different needs and decided to implement their own code... so I am a bit lost: I don't want to reinvent my personal wheel.
Probably the SPL interfaces for implementing the observer pattern are a bit naive, so I'm here asking you: what would you do?
EDIT
Since it's not clear... I want to re-use an existing ED, letting the developer inject it in my library.
Let's say you develop a lib with a dispatcher and you know that your lib is gonna be a part of a Symfony Bundle and also re-used in ZF projects: you surely want to re-use Symfony's and ZF dispatchers, instead of your own.
Therefore I was looking for shared interfaces for existing dispatchers implemented in mainstream libraries, but sounds like there's no solution.
You could define an interface for your needs and then implements it with differents adapters for each framework.
I think your first instinct to pick one of the widely used components is the way to go.
Those two are the options I would be considering as well. You should simply take a look at both of them and pick the one you feel will work best for you.
Shameless plug: If you want something really, really lightweight, you can take a look at Événement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With