views:

80

answers:

3
+3  Q: 

Zend with Symfony

There seems to have been previous attempts to integrate Zend with Symfony in the same project. I hear it can be done and has been done, but aside from a slide show linked below, the actual video accompanying the slide show is not freely available.

So does anyone know of good resources that explain such integration well? blogs, videos, whatever. I'll add whatever you post here for easier access to others in the future.

Resources I've found so far:

Edit: I should add if you've done this yourself before, can you also please post any tips (as little or lots) to help those who may want to try it.

+2  A: 

From the discussion above:

I was thinking to use Symfony as the base + Zend components as needed. So I will be using Symfony's folder structure but none of Zend's bootstrap and ini.

From my experience with ZF I would say, this can definitely be done and is worth simply getting started with.

You'll have to haggle with Autoloading a bit (you should probably load all Zend related includes manually and not use its autoloader at all) but other than that, I can't see any problems. (disclaimer: I don't know Symfony in depth at all and can't comment on possible namespace collisions, but seeing as Zend was built to avoid those, and Symfony is a mature framework, I don't think you'll encounter anything impossible.)

Pekka
+2  A: 

If you're using Symfony as your top-level framework, it's trivial.

In fact, integrating a Zend Framework component even used to be part of the standard symfony tutorial.

timdev
I didn't say anything about doctrine. I'm talking about Zend_Mail, which he integrates down near the end.
timdev
+4  A: 

It is completely simple to add the Zend framework to run in Symfony. There are certain components of the Zend framework that compliment the Symfony framework. I am currently using Zend for the Lucene Search, as well as their Mailer.

To use Zend in Symfony, you just need to do two things:

  1. Copy the Zend framework to your /lib/vendor/ folder.

  2. Modify the ProjectConfiguration file. (config/ProjectConfiguration.class.php)

      class ProjectConfiguration extends sfProjectConfiguration 
      {
         static protected $zendLoaded = false;
         static public function registerZend()
         {
            if (self::$zendLoaded) { return; }
            set_include_path(sfConfig::get('sf_lib_dir').'/vendor'.PATH_SEPARATOR.get_include_path());
            require_once sfConfig::get('sf_lib_dir').'/vendor/Zend/Loader/Autoloader.php';
            Zend_Loader_Autoloader::getInstance();
            self::$zendLoaded = true;           }      }
    

All this can be found in the Symfony tutorial here: http://www.symfony-project.org/jobeet/1_4/Doctrine/en/17

Jon