Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • this text slide show

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.

like image 269
jblue Avatar asked Sep 19 '10 20:09

jblue


People also ask

Is Zend better than laravel?

Laravel has a steep learning curve to master the framework, whereas Zend has a hard learning curve and takes time to implement. Laravel has poor performance and speed compared to Zend, whereas Zend improves application performance and provides a good response for the server request.

Is Zend Framework Good?

When it comes to PHP frameworks, Zend is counted among the best. Zend Framework offers lots of benefits for creating feature-rich and dynamic web solutions. MVC features and a strong component library have made Zend a popular PHP framework for creating a myriad of web solutions.

What is Symfony good for?

Symfony is a feature-rich back-end framework that is used to build complex applications. Many developers still prefer the lightweight Silex micro-framework or the Symfony MicroKernel, and Symfony is a widely used application framework among open-source developers.

What is Zend used for?

Overview. Zend Framework is a collection of professional PHP packages with more than 570 million installations. It can be used to develop web applications and services using PHP 5.6+, and provides 100% object-oriented code using a broad spectrum of language features.


2 Answers

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

like image 167
jgallant Avatar answered Sep 28 '22 15:09

jgallant


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.)

like image 43
Pekka Avatar answered Sep 28 '22 16:09

Pekka