I am sure you already heard about the Zend framework. It provides some nice components (don’t confuse them with Cake components) for which there are no equivalents in the core of CakePHP. Due to the flexibility of CakePHP it is relatively easy to use these Zend components within a CakePHP application (be aware that the Zend Framework requires PHP5). You have to perform the following steps:
- Download the Zend Framework
- Copy the files from the library directory in the zip file to your app/vendors directory
- Create a wrapper file in vendors in which you include the components you want to use. In the example below I want to use the Zend_Feed component:
//app/vendors/zendfeed.php <?php ini_set('include_path',ini_get('include_path').PATH_SEPARATOR . dirname(__FILE__));?> <?php require_once('Zend/Feed.php'); ?> - Make the Zend component accessible in your controller with
vendor('zendfeed'); - Use the Zend component and have fun ;-)
Thanks go to Miguel Ros and Felix Geisendörfer for their help!
6 Comments
so – is this by ‘design’ in cake, or just a happy accident that this works. or are there higher ‘objects’ at work here :)
either way, sounds very good for the ‘extensibility’ [deliberate misuse of the terms here] of the cake classes.
i really do look fwd to seeeing ‘extended’ versions of the zend classes [correct use here] applied within the cake environment – this would (imho) make it one of the most powerful ‘adaptive’ frameworks out there.
jimibt,
This was by design, but not specifically to use the ZF classes, it was to use any “vendors” classes that we do not ship in the core.
larry,
worthy of a tutorial in itself methinks (if there is one, then obviously, feel free to ridicule me here online!! – and if not, an example using ZF, seagull etc would be VERY good)
thanks again
jimi
Can I use CakePHP inside ZF? :D
@guest: I don’t know. Try it, and let us know if it works ;-)
@guest – yes let us know – I tried but cake is too tightly integrated with itself
One Trackback/Pingback
Daniel Hofstetter’s Blog: Use components from the Zend Framework with CakePHP