Use components from the Zend Framework with CakePHP

Published on and tagged with cakephp  component  zend

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!

12 comments baked

© daniel hofstetter. Licensed under a Creative Commons License