Is there a consensus on how plugins should be implemented in a PHP application?
I\'ve looked into the observer pattern which comes close, it\'s really just a notificati
The way you've done this, with hooks is also how I implement this.
The biggest problem with your sample though, is that your function instantiates the plugin. Why not pass an instance of the plugin instead?
The way I've done this, is that a plugin gets instantiated first, and registers its hooks itself.