Zend Framework WordPress Plugin

This plugin is used for autoloading the Zend Framework into WordPress.  For the plugin to work, you must download the Zend Framework (here), and place it on your webserver in the folder “wp-library” (you will have to create that folder). It will also autoload any other libraries you have placed in the “wp-library” folder.  These additional libraries must follow the same directory structure as the Zend Framework (see below).  The plugin uses the Zend Framework’s Zend_Loader to autoload Zend and any other libraries (so you do not have to “require” them explicitly).  To prevent autoloading classes defined by WordPress (and causing errors), the plugin searches the “wp-library” directory for other folders and only autoloads classes prefixed with the folder names it finds.  

You can download the plugin right here.

Example of wp-library directory structure:  

dir -> public_html

dir ->-> wp-library

dir ->->-> Zend

dir ->->->-> The Zend Framework library contents (all classes are prefixed with “Zend_”)

dir ->->-> Mylib

dir ->->->-> Contents of custom library named Mylib (all classes are prefixed with “Mylib_”)

Zend_Loader converts the string specifying the class name (eg Mylib_Http_Client) into a relative path (so the libary’s root directory “Mylib” must be in the include path, the WP Library Autoloader plugin adds the “wp-library” directory to the include path).  In converting to a relative path, the Zend_Loader substitutes underscores “_” for directory seperators (the PHP constant DIRECTORY_SEPARATOR, either “/” on Unix/Mac or “\” on Windows) and appends “.php” to the file.  The class name “Mylib_Http_Client” would then become “Mylib/Http/Client.php”

Additional information on the directory structure for autoloading classes with Zend Loader is available from the Zend Framework reference guide.

Any comments or suggestions for this plugin are greatly appreciated.  If you have any other ideas or questions on using the Zend Framework with WordPress, just drop us a comment!

9 Comments on Zend Framework WordPress Plugin

  1. SEO Spider » Blueberryware
    October, 30th 2008 at 7:33 am

    [...] example, I could have it search for “zend framework wordpress plugin” to see if my Zend Framework WordPress Plugin is listed there.  It will also be able to view your backlinks to any given page published in your [...]

  2. Slavi
    November, 25th 2008 at 10:22 am

    That’s interesting :)
    This opens a nice opportunities of integration between ZF and WP.

  3. Fred Isaacs
    January, 18th 2009 at 11:13 am

    Great work!

    I just have one small criticism. You should probably use spl_autoload_register() to setup your __autoload() function.

    This way we are not restricted to using only one php5 enabled plugin that wants to autoload its resources.

    :-)

  4. steve
    March, 4th 2009 at 3:09 am

    Do you have any example plugins or themes built using Zend Framework?

  5. roso
    March, 11th 2009 at 4:48 pm

    Yes, I would like to see a plugin using the Zend Framework.

  6. steph
    May, 14th 2009 at 8:01 am

    I was googling for Wordpress integration into the Zend Framework and your site came up. Wouldn’t it make more sense to have a Wordpress port for ZF instead of the otehr way around? Not that I have any idea how this would be accomplished ;)

  7. Wordpress SEO Plugins « Azghanvi’s Tech Co...
    June, 4th 2009 at 11:14 am

    [...] pages.  For example, I could have it search for “zend framework wordpress plugin” to see if my Zend Framework WordPress Plugin is listed there.  It will also be able to view your backlinks to any given page published in your [...]

  8. Hikari
    June, 13th 2009 at 10:36 pm

    This seems too much wonderful to be true. Does it really work? I’d like to see a plugin developed with Zend working too!

    Don’t see me wrong, I’m not doubting you, just can’t believe it exists :D

    Unfortunately I can’t test it yet, because I’m still researching if I should learn Zend or Cake, and I’m very inclined to choose Zend.

    If with this plugin it is possible to develop Wordpress plugins that use Zend and even integrate Zend controllers and use Wordpress as the view, I’ll definetely go for Zend and use your plugin.

    Please, please! keep up the great work and don’t let this plugin break :D

  9. Web Design Adelaide
    June, 26th 2009 at 10:45 am

    This is looking good. Like was said before, I stumbled across this post, by looking for integrating wordpress alongside zend. Will give this a try though, because wordpress is powerfull by itself, but with Zend’s features alongside it, well… it can onlly get better really.
    thanks

Leave a Reply


WP Login