Easy way to use Zend Framework in CakePHP

More cursing this morning as I tried to integrate Zend Framework’s GData within my project. After a bit of trial and error I came across this simple easy solution:

1. Save the ZF folder as Zend in your [app]/vendor folder
2. Create a file named zend_include.php in your [app]/vendor folder and paste the following code in it:
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname(__FILE__));
3. To use in Cake, do this:
App::import('Vendor', 'zend_include');
App::import('Vendor', 'Zend_Gdata_YouTube', true, false, 'Zend/Gdata/YouTube.php');

(Replacing Gdata_YouTube and /Gdata/YouTube.php with the proper Zend Library you’re trying to use)
4. You can then call
$zend = new Zend_Gdata_Youtube(); // etc

I wish I could take full credit for this but it was this comment that finally got me on my way.

Leave a comment

1 Comment

  1. Shawn Zelmer

     /  June 7, 2012

    Hi Jen…

    Thank you very much for this. It helped answer some questions I was having. Unfortunately now I have more…LOL Have you used this implementation for interaction between a Cake site and YouTube, if so I would be massively appreciated if you could give me a hand with this. Thx


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: