I worked with Symfony for almost 3 years, from 2008 to 2010. This year I'm working on a big Ruby on Rails project. And before 2008, most of the work I did involved hacked together PHP projects. I would say that if one can use Ruby On Rails, then of course one should. It doesn't matter whether Ruby is better than PHP as a language, what is certain is that Ruby ecosystem is much stronger than anything in the world of PHP, and for any large project you will be depending on whatever ecosystem surrounds a language.
Having said that, I would say that Symfony is the best hope for PHP. It is the framework that takes PHP furthest forward, and offers the best starting point of a strong ecosystem. Symfony imitates many of the best features of Rails.
I've worked on a lot of PHP projects. I've worked on WordPress and Drupal and CakePHP. I dislike nearly all software written in PHP. But Symfony is elegant and clean and the people behind it are serious and intelligent. If you have to work with PHP, then you should work with Symfony.
However, I do not expect the Symfony community to ever grow large, and I will quote something that I wrote on my blog a year ago to explain why:
"No matter what data source you consult, the conclusion is unmistakable: Symfony is a small community, and its rate of growth is slow. Why is this? My own theory is that Symfony brings to PHP something that PHP has long been missing: a truly professional, industrial strength, object oriented architecture that allows PHP to be taken seriously in the enterprise. However, all of the people who would be truly interested in such a framework have long ago found a home using Ruby, Java or Python. In short, the kinds of people who gravitate to PHP are exactly the kind of people who are unwilling or unable to appreciate the beautiful elegance and power of a system like Symfony. The people who need something like Symfony gravitate to other languages."
This still conflates language with platform/framework. There's a reason PHP is big and Symfony is small - only a fraction of the PHP users have needs that are met by symfony and have the time/effort to learn symfony in the first place.
There's actually probably multiple reasons, but that's the easiest one off the top of my head. PHP's used in all kinds of web places that Ruby isn't, mostly because Ruby's not a great fit in those places.
Hello <?=$name;?> it's <?=date("h:i:s");?>.
I've never met anyone who does 'ruby pages' and drops ruby in to various files as needed for small stuff. You can do that and many people do with PHP.
All web work I've ever seen done in Ruby uses Rails or Sinatra or some framework. Only a portion of web work I've seen in PHP uses any community framework. This is just the way it is.
Your point on ecosystems is correct - the ZF system is probably the closest modern one out there (indeed, ZF should have been called PEAR2 years ago) - Symfony uses bits of ZF libraries as needed. But because of the naming, people think you use all of it. Because Rails was/is the dominant web framework in Ruby for so long, it feeds on itself, and people end up writing cool stuff for Rails, and more people use it because of the cool stuff, lather rinse repeat. The cool symfony stuff mostly can't be used outside symfony, CI stuff not usable outside CI, etc.
There's some cool stuff in Grails I use - it's not possible in PHP (maybe in the future if the language changes) so I use Grails when need be (or when I feel like it). No amount of libraries/frameworks in PHP will make up for the missing language features, and this is the heart of your last paragraph (which I agree with). I still use PHP for a lot of stuff, but have expanded out to other tools that fit other use cases better.
I do wish I'd see other camps being as broadminded as they exhort PHP users to be, though. By and large, there's stil loads of people that try to do all their projects in Rails, or J2EE, or .NET, or Django, or whatever. PHP's got its place, and sometimes really is the best choice for a project. Ultimately, there's still loads of fanboys out there in all camps. :/
I totally agree with you about the difference between the Ruby and PHP communities. But I think when you say "the best hope for PHP...", you might be forgetting that not every project using PHP is a big application. I think Rails would be overkill for a smaller project (for example, an informational website for a small business), and so would Symfony (which the author of the linked article says himself). I bet a majority of the usage of PHP out there is for much smaller tasks that might benefit a little bit from a framework (or at least a separation of concerns), but would not be worth switching to a different language and platform (not to mention the deployment piece of the puzzle).
To all those who have ever taken a look at Symfony: v1 was ugly but v2 is much more palatable to people with experience in Python/Ruby/Node, and the docs are pretty darn good, so have another look.
If I'd be forced to use PHP for my projects — which, luckily, I'm currently not — I'd pick Symfony2 over Yii, CodeIgniter and CakePHP any day.
I'm curious; what is it about Symfony2 that makes you recommend it over CakePHP?
I really enjoy using CakePHP personally, and I found Symfony v1 a headache to start with and never really got off the ground with it. It's interesting to me that the CakePHP 2.0 release got no love while Symfony2 is front page material. Any insight here would be appreciated.
I have a few years experience with CakePHP, Symfony 1 and I have also been playing around with Ruby on Rails a bit.
Now, I just finished going through the Symfony 2 internals to see what is so different from Symfony 1. I have to say that, when I realized the paradigm change, I had a WOW moment.
I mean most of the frameworks gravitate around the classical "MVC monilith active record framework" and they all resemble more or less Rails.
Symfony 2 isn't even a MVC framework (although it separates concerns very well), I mean it doesn't even have a Model!!!
At the core it's a Kernel object that is responsible for building a Service Container for dependency injection, into which all sorts of Components get pluged-in as services. And along the way it triggers lots of events to which you can attach listeners.
That's it! Everything else you augment by choosing the kind component you want to use and by configuring the Service Container.
After the little bit I played around with Ruby on Rails I have to say that Ruby is much nicer then PHP, but as a framework I really like where Symfony 2 was taken.
PHP can be very handy for simple tasks -- and that make it very popular among starter programmers and unpopular as an enterprise, serious programming language for many experienced programmers. From my point-of-view, this is like you are trying to differentiate yourself through the tools you use and not your actual work.
Regarding PHP frameworks: A year ago I decided to try most PHP frameworks. I recall working with ZendFramework, Symphony (not v2 to be honest), CakePHP and Yii. At the end of the day I preferred and used Yii simple because it made easier to start producing something useful.
i just had a look at it..
one: i feel sad for all who are 'married' to php. :-P
two: it seems that php is catching up on the frameworks (code ignitor, cake, yii, and this one)
Thanks, but I don't need your pity. I enjoy working with PHP, and I really enjoy studying, playing around, and finally making money with quality frameworks like Kohana and Symfony2 (still learning this one).
I may not be an uber-programmer like you, or have a $55,000 college education/loan, but PHP makes it easy, fun and profitable to be self taught.
So, yes, I'm "married" to PHP, much like I'm married to jQuery, but keep your pity to yourself.
I like the way Symfony2 is laid out. The project structure it gives you seems better suited to large applications than the way Rails lumps everything together.
Unfortunately, in the beta, you had to place the bundle name/path in a about six different places for a single bundle. It was somewhat cumbersome to do manually (although there was a rails-like generator script).
I also wasn't trilled with the debug messages. Half the time they gave information about the internals of the framework and no reference to the place in my bundle where the error was.
[+] [-] lkrubner|14 years ago|reply
Having said that, I would say that Symfony is the best hope for PHP. It is the framework that takes PHP furthest forward, and offers the best starting point of a strong ecosystem. Symfony imitates many of the best features of Rails.
I've worked on a lot of PHP projects. I've worked on WordPress and Drupal and CakePHP. I dislike nearly all software written in PHP. But Symfony is elegant and clean and the people behind it are serious and intelligent. If you have to work with PHP, then you should work with Symfony.
However, I do not expect the Symfony community to ever grow large, and I will quote something that I wrote on my blog a year ago to explain why:
"No matter what data source you consult, the conclusion is unmistakable: Symfony is a small community, and its rate of growth is slow. Why is this? My own theory is that Symfony brings to PHP something that PHP has long been missing: a truly professional, industrial strength, object oriented architecture that allows PHP to be taken seriously in the enterprise. However, all of the people who would be truly interested in such a framework have long ago found a home using Ruby, Java or Python. In short, the kinds of people who gravitate to PHP are exactly the kind of people who are unwilling or unable to appreciate the beautiful elegance and power of a system like Symfony. The people who need something like Symfony gravitate to other languages."
http://www.teamlalala.com/blog/2010/04/11/the-symfony-commun...
[+] [-] mgkimsal|14 years ago|reply
There's actually probably multiple reasons, but that's the easiest one off the top of my head. PHP's used in all kinds of web places that Ruby isn't, mostly because Ruby's not a great fit in those places.
Hello <?=$name;?> it's <?=date("h:i:s");?>.
I've never met anyone who does 'ruby pages' and drops ruby in to various files as needed for small stuff. You can do that and many people do with PHP.
All web work I've ever seen done in Ruby uses Rails or Sinatra or some framework. Only a portion of web work I've seen in PHP uses any community framework. This is just the way it is.
Your point on ecosystems is correct - the ZF system is probably the closest modern one out there (indeed, ZF should have been called PEAR2 years ago) - Symfony uses bits of ZF libraries as needed. But because of the naming, people think you use all of it. Because Rails was/is the dominant web framework in Ruby for so long, it feeds on itself, and people end up writing cool stuff for Rails, and more people use it because of the cool stuff, lather rinse repeat. The cool symfony stuff mostly can't be used outside symfony, CI stuff not usable outside CI, etc.
There's some cool stuff in Grails I use - it's not possible in PHP (maybe in the future if the language changes) so I use Grails when need be (or when I feel like it). No amount of libraries/frameworks in PHP will make up for the missing language features, and this is the heart of your last paragraph (which I agree with). I still use PHP for a lot of stuff, but have expanded out to other tools that fit other use cases better.
I do wish I'd see other camps being as broadminded as they exhort PHP users to be, though. By and large, there's stil loads of people that try to do all their projects in Rails, or J2EE, or .NET, or Django, or whatever. PHP's got its place, and sometimes really is the best choice for a project. Ultimately, there's still loads of fanboys out there in all camps. :/
[+] [-] jasonlotito|14 years ago|reply
Well, that's your problem right there. Don't blame C for Windows XP.
[+] [-] jordanlev|14 years ago|reply
[+] [-] stdbrouw|14 years ago|reply
If I'd be forced to use PHP for my projects — which, luckily, I'm currently not — I'd pick Symfony2 over Yii, CodeIgniter and CakePHP any day.
[+] [-] w33ble|14 years ago|reply
I really enjoy using CakePHP personally, and I found Symfony v1 a headache to start with and never really got off the ground with it. It's interesting to me that the CakePHP 2.0 release got no love while Symfony2 is front page material. Any insight here would be appreciated.
[+] [-] julesm|14 years ago|reply
Now, I just finished going through the Symfony 2 internals to see what is so different from Symfony 1. I have to say that, when I realized the paradigm change, I had a WOW moment.
I mean most of the frameworks gravitate around the classical "MVC monilith active record framework" and they all resemble more or less Rails.
Symfony 2 isn't even a MVC framework (although it separates concerns very well), I mean it doesn't even have a Model!!!
At the core it's a Kernel object that is responsible for building a Service Container for dependency injection, into which all sorts of Components get pluged-in as services. And along the way it triggers lots of events to which you can attach listeners.
That's it! Everything else you augment by choosing the kind component you want to use and by configuring the Service Container.
After the little bit I played around with Ruby on Rails I have to say that Ruby is much nicer then PHP, but as a framework I really like where Symfony 2 was taken.
[+] [-] pxtreme75|14 years ago|reply
The truth is that when you need to get things does PHP can be a much more convinient tool than ruby-on-rails. The following Blog describe this better than I would ever do: http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_swit...
Regarding PHP frameworks: A year ago I decided to try most PHP frameworks. I recall working with ZendFramework, Symphony (not v2 to be honest), CakePHP and Yii. At the end of the day I preferred and used Yii simple because it made easier to start producing something useful.
[+] [-] lhnz|14 years ago|reply
[+] [-] cies|14 years ago|reply
[+] [-] jtreminio|14 years ago|reply
I may not be an uber-programmer like you, or have a $55,000 college education/loan, but PHP makes it easy, fun and profitable to be self taught.
So, yes, I'm "married" to PHP, much like I'm married to jQuery, but keep your pity to yourself.
[+] [-] jamesgeck0|14 years ago|reply
Unfortunately, in the beta, you had to place the bundle name/path in a about six different places for a single bundle. It was somewhat cumbersome to do manually (although there was a rails-like generator script).
I also wasn't trilled with the debug messages. Half the time they gave information about the internals of the framework and no reference to the place in my bundle where the error was.