Categories
symfony Uncategorized

Symfony Rocks?

It happens that we are using symfony for a pretty long time (in fact since it’s beginning) and what is probably more important we always considered PHP as the only “right” language 🙂

For the last few months we were extending our horizons and digging into similar to symfony solutions. Obviously first things we paid attention to python Django and ruby Rails frameworks which inspired creators of symfony. And the other framework we’ve looked at – java Play – this one is very similar to symfony b/c it inherits both from django and rails as well and introduce own unique features.

But why someone may start looking for another framework?
First of all it’s about interest if there is something better than symfony (even if it requires learning of new language). And it’s good interest b/c when we looked how Rails and Django built – we understood why they are so popular. And it’s not only about language syntax. For instance here is how Rails propose to add validators inside actual model class:

class Subscriber < ActiveRecord::Base
  validates_uniqueness_of :email, :message => "already exists on our list"
  validates_format_of :email, :with => /^[a-z0-9_.-]+@[a-z0-9-]+\.[a-z.]+$/i
end

There are many more other small things which makes Ruby On Rails projects code looks much simpler than its analogue in symfony.

Java’s “Play” framework is another sample of “useful” framework. There are lot of resources out there which are written on Java and there is no way to use them in PHP (one of samples is Scala language which can be embedded into Java code). Here is where “play” can be used – you have all advantages of Java in style very similar to symfony 1.0.x branch (oh yes!). Along with that they have some cool small features, e.g. using memory database (so debugging becomes much more faster). That’s how looks part of their configuration file:

# Database configuration
# ~~~~~ 
# Enable a database engine if needed.
#
# To quickly set up a development database, use either:
#   - mem : for a transient in memory database (HSQL in memory)
#   - fs  : for a simple file written database (HSQL file stored)
db=mem
#
# To connect to a local MySQL5 database, use:
# db=mysql:user:pwd@database_name

Another story is symfony development. This week there was published article:

http://laurent.bachelier.name/2010/07/why-i-wouldnt-use-symfony-for-a-new-project/

I can’t say I’m totally agree with author. But I don’t agree with Fabien’s appearance there in comments. That’s the fact that Sensio is driving symfony in way convenient for them and it’s not bad. But on the other hand their vision is very own so that’s why not everyone agrees with Fabien (=Sensio).

It’s worth to mention also about multiple comparisons available for these and some others frameworks:

http://blog.ifabio.com/2010/03/02/django-rails-symfony-a-different-point-of-view/

http://www.cmswire.com/cms/industry-news/php-vs-java-vs-ruby-000887.php

http://townx.org/blog/elliot/i_hear_a_symfony_rails_vs_the_symfony_php_framework

http://blog.enricostahn.com/2009/11/30/comparison-symfony-vs-ruby-on-rails.html

http://davidcummings.org/2008/02/17/comparing-phpsymfony-and-ruby-on-rails/

http://npzrk8rz.wordpress.com/2008/01/17/ruby-vs-php-performance/

http://elliottback.com/wp/ruby-vs-php-performance-revisited/

It’s mostly about performance not usability though.
Would be interesting to hear which web framework you prefer to use along with symfony and why?
After that we are going to pick them all together and start one more survey to figure out popularity of frameworks in symfony world.