Midgard in the Symfony2 world

So, Symfony2 was released today. Now, you may remember me complaining about the fragmentation in the PHP community, as well as suggesting various technologies that have the power to bring the community together. But what I haven’t talked about is convergence in the area of PHP frameworks.

Frameworks are generally problematic concerning cross-project collaboration, as most of the code written against a particular framework tends to run only on that framework. If things are properly decoupled, and most of the logic is in generic libraries, this doesn’t matter so much. But still, having a common framework most of the code is written for helps, as can be seen in the Ruby community.

So, to advance this goal, we in the Midgard Community have made a decision to start aligning our PHP code to Symfony2. The ideas behind SF2 are quite compatible with our views:

Symfony2 embraces standards: First, Symfony2 is willingly centered around the HTTP specification (just have a look at the built-in HTTP reverse proxy). Then, we are embracing the PHP standards: PHPUnit, namespaces, PSR-0 autoloader, … That makes Symfony2 easily interoperable with many other great PHP libraries.

Symfony2 is decoupled: Beside being a full-stack framework, Symfony2 is also a set of decoupled and cohesive components; Symfony2 is made of 21 components that can be used as standalone libraries: they have their own Git repositories, and they are all available as PEAR packages.

For us this alignment means making sure code written for MidCOM and Midgard MVC, our two PHP frameworks runs properly under Symfony2, and filling various functionality gaps that exist between our frameworks and SF2.

I believe this to be a great opportunity for both communities. Especially for Midgard users this brings a great promise of future functionality coupled with full backwards compatibility.

Here are some very early results of this collaboration:

  • Symfony2 can now be run on AppServer-in-PHP with our AppServerBundle. Great performance and deployment benefits can be had by adopting AiP, so having a simple way to run SF2 with it is useful
  • There is a ConnectionBundle which is responsible for initializing and connecting to a Midgard2 content repository
  • Midgard MVC components can now be run as part of a Symfony2 application with the MvcCompatBundle. Lots of work there still remains, but it is a good start

Here you can see a screen from a simple AiP-powered SF2 application, running the org_midgardproject_news component displaying content from the Midgard2 repository rendered via TAL:

Midgard says Hello World

After the Midgard MVC compatibility work is done we will also focus on ensuring full MidCOM applications run on Symfony2. There is already some precedent for this sort of compatibility work, as you can also run Zend Framework applications under Symfony2.

Congratulations to the Symfony2 community for a great release! I look forward to a lot more collaboration in the future.


Read more Midgard posts.