News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Felix Geisendörfer's Blog:
Welcome to the Dark Side of Plugins in CakePHP
June 26, 2006 @ 06:27:28

CakePHP users out there looking to squeeze just a bit more out of their plugins might want to check out this new post over on Felix Geisendörfer's blog today. He shows how he's worked around two issues that have bothered him with the current framework setup - inter-plugin communication and filter callbacks.

He starts off by looking at the filter callbacks, looking to make "drag and drop-able" plugins for his setup. He notes that, right now, you'd have to call a plugin to perfom an action, making for a good bit of load depending on the application structure. It also means that you have to change the Controller to add a new plugin ("...which doesn't seem like a very RAD approach to me").

So in order to streamline such plugin callbacks, I created a function inside SpliceIt!, that allows plugins to hook into any AppController event, such as beforeFilter, afterFilter, beforeRender, etc. in order to make their own changes to the controller. So a Themes plugin can easily change the Controller::view and a Statistics plugin can make calls to a Model.

He gives the code for the function as well as an example of how to use it in your app.

Moving on, he looks at his next issue to overcome - inter-plugin communication:

Generally spoken Controller::requestAction() isn't a bad way to exchange data between controllers. It's a clean interface and you don't have to plan in advance what data should be exchangeable and what data should not. However, there are a couple problems with it.

His solution involves the creation of an entirely seperate ApiController pattern. Of course, he provides examples, specifically related to his SpliceIt! application.

0 comments voice your opinion now!
cakephp framework mvc plugin callback hook inter-plugin communication cakephp framework mvc plugin callback hook inter-plugin communication


blog comments powered by Disqus

Similar Posts

Suresh Ariya: Integrate Zend Framework into CakePHP application

Matt Curry's Blog: Interactive Plugin For CakePHP Console and DebugKit

NetTuts.com: How to Setup Laravel 4

NETTUTS.com: Getting Started With Cake PHP: Part 2

Symfony Blog: The "Practical symfony" book is now also available for Doctrine


Community Events





Don't see your event here?
Let us know!


language symfony framework version voicesoftheelephpant series threedevsandamaybe conference api configure podcast interview composer list unittest laravel release introduction opinion community

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework