Using the Zend Framework in CakePHP

What do you get when you combine the powers of CakePHP 1.2.x and the Zend Framework?

No, not Captain Planet… something much more powerful – the ability to use the Google Data API PHP library! This is useful if you want to use Google Calendar or any of the other services supported by the data API.
Loading the Zend Framework isn’t as straightforward as App::Import(…), since Zend’s libraries assume that the Zend Framework folder is in your include path. To get around this simply:

  1. Drop the Zend Framework Library folder into your vendors folder
  2. Create a script in your Vendors folder called something like zend_include_path.php with the following statement:

    ini_set('include_path', ini_get('include_path').dirname(__FILE__));

  3. In your action, just do the following, replacing Gdata.php with whatever library you wish to load (i.e. Loader.php):
    function myAction() {
    App::import('Vendor', 'zend_include_path');
    App::import('Vendor', 'Zend_Gdata', true, false, 'Zend/Gdata.php');


Voila! You should now be able to instantiate your loaded Zend Library Class and work with it normally.