Use components from the Zend Framework with CakePHP

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:

  1. Download the Zend Framework
  2. Copy the files from the library directory in the zip file to your app/vendors directory
  3. 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:
    <?php ini_set('include_path',ini_get('include_path').PATH_SEPARATOR . dirname(__FILE__));?>
    <?php require_once('Zend/Feed.php'); ?>
  4. Make the Zend component accessible in your controller with
  5. Use the Zend component and have fun ;-)

Thanks go to Miguel Ros and Felix Geisendörfer for their help!



  1. jimibt
    Posted April 23, 2006 at 9:09 pm | Permalink

    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.

  2. Posted April 24, 2006 at 12:25 am | Permalink


    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.

  3. jimibt
    Posted April 24, 2006 at 1:35 am | Permalink


    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


  4. guest
    Posted June 24, 2006 at 2:55 am | Permalink

    Can I use CakePHP inside ZF? :D

  5. Posted June 24, 2006 at 9:11 am | Permalink

    @guest: I don’t know. Try it, and let us know if it works ;-)

  6. Posted July 9, 2006 at 4:24 am | Permalink

    @guest – yes let us know – I tried but cake is too tightly integrated with itself

One Trackback/Pingback

  1. Daniel Hofstetter’s Blog: Use components from the Zend Framework with CakePHP

%d bloggers like this: