Hacker News new | past | comments | ask | show | jobs | submit login
Symfony 2.0 is now available (symfony.com)
113 points by j0k3r on July 28, 2011 | hide | past | favorite | 72 comments



I've looked through some source code in the Symfony 2 components. The code is well organized, commented, and most of all it is of high quality.

As far as I am concerned, Symfony 2 is the gold standard example for developing a PHP project of any kind.


i researched a few php frameworks (sy2, zend, cake, li3, kohana, etc.) a little while, and by far i'm most satisfied with lithium (li3, http://lithify.me/). depending on 5.3 seems to open up a wide range of possibilities and oftentimes i feel like 'this is the way to do it', whereas i felt like 'the framework is getting in my way' with sy2 for example.


what do you think about Yii framework which is also gaining popularity these days,


I used Yii for a little bit while trying to decide if I wanted to use it or Symfony 2, and I just didn't like it. The page caching felt horribly clunky to me, and there was no built-in way to manage HTTP headers.

Ultimately though, I didn't decide against Yii because of what it couldn't do, but decided on Symfony 2 because of what it did do. It was just a more pleasant experience, and I never felt like I had to fight the framework to do what I wanted to do. Sure, it had a steeper learning curve than Yii (I started using it in the preview release stage, when documentation was in flux), but I feel that it made me write better code.


I think it's disgusting. It tries to use the component model, similar to ASP.NET. Even Microsoft realized what a disaster it was, and the community moving to ASP.NET MVC, which is similar to traditional frameworks.


If you need a lightweight - Sinatra like framework check http://silex-project.org/ it is built from Symfony components and works like a charm


Silex is cool. I did a quick-and-dirty benchmark with it and AiP a while back, and performance was comparable to Node.js and Express:

http://bergie.iki.fi/blog/php_can_perform_better_than_node-j...


The project team did an amazing job with this release. I'm not a Symfony user myself, but their website is very professional and well organized and the documentation is excellent -- very thorough and updated for the new release.

Beyond methodology and community, one of the major decisions involved when selecting a framework is being confident that your codebase will be supported in the near future. The Symfony developers and community seem very committed to their framework. Great Job!


I'm woking with Symfony 2 now for a half-year. And I can say that it is brilliant. Dependency Injection that they have implemented is a really nice feature. It is also great that it consists of de-coupled components. You can use any of the components including Dependency Injection in ur PHP projects.


Same here, I have been using it on a new project since November 2010 and it has been great, following the commits on Github and upgrading when necessary has been relatively easy. This project has really opened my eyes to the power that Git + Github (when used properly) can bring to open source software.

I would also like to add that Fabien Potencier has been amazing and is officially a coding Robot!


For those wants to know more about Symfony, I can assure you Symfony and Yii are at different leagues. Symfony is so much more featured than any PHP framework out there. Yml based settings and modeling plus the Admin Generator is one of a kind. I believe it is even better than Django and Rails, when it comes to flexibility and extensibility.


Just curious about that first sentence there... are you saying that Symfony and Yii are both in the same league, different from everything else, or that Symfony is in a league different from the one that Yii is in?

I haven't looked at Symfony, but I was really impressed by the event driven nature of Yii, and I couldn't wipe the smile off my face when I started looking into the active page elements.

I think 2.0 is as good an excuse as any to check out Symfony though, so goodbye to the weekend :)


I was meaning "Symfony is in a league different from the one that Yii is in"

I value Symfony so much because you can create all model classes, crud forms etc from command line (as much as you want as you update your schema) just based on specifications from a easy to manage yml file. Also with ORM behaviors, you are in control of everything about your model.


In that case I wonder what makes you compare the two frameworks and what you actually think the two are in such a separate league. You keep talking about Symfony without actually comparing it with Yii as your initial statement made me think you would. :)


Sorry about misleading, when I talk about symfony and tell about its features, I tried to pick superior parts where Yii lacks


I also have some experience with symfony, at least 1.0. If you are one of those who thinks rails seems nice, but the job demands php/you prefer php, symfony is a good choice.

symfony was the project that made me realize that php doesn't need to be ugly.


How is 'yml based settings' one of a kind, or a deal-breaker when choosing frameworks?


I should not say 'yml based settings' is a deal-breaker but it sure is a very good way of configuring the project. I personally take advantage of this convenience quite often. You can easily update your schema through yaml files and you can build&generate your whole model including auto-generated forms & filters for CRUD in a glimpse. I believe this is very friendly with agile principles.


But you can just as easily update settings stored in other formats.


Yes you are right. But It does not have to be all about yaml format itself. Instead, Symfony utilizes this format to get things done in a fast and neat way, in comparison to others.


Does Symfony had Lazy loading? which is the reason behind the performance of Yii.


Congratulations to Fabien and the Sensio team! Fabien is an amazing evangelist for the framework, and I've had the good fortune to attend Fabien's talks on multiple occasions. I've used Symfony since 2007 and it's clear the framework has staying power and significant adoption with each new year. Congrats again!


I'm currently in process of building compatibility layers from our two old PHP frameworks (MidCOM and Midgard MVC) to Symfony, and have been very pleasantly surprised with both the code quality and the responsiveness of the community.

As part of this work I will also write new Symfony2 bundles for whatever functiolity our old frameworks had a SF2 misses. The first one is the ability to run Symfony2 apps under AppServer-in-PHP, a pure-PHP application/HTTP server. No Apache required! :-)

https://github.com/bergie/MidgardAppServerBundle


Since PHP 5.4 there's a web server built-in: http://php.net/manual/en/features.commandline.webserver.php

Maybe you could rely on that, instead of aip :)


Maybe, though AiP gives us nice control of the process. And it also supports other modes than HTTP, like Mongrel2 and SCGI:

https://github.com/indeyets/appserver-in-php/tree/master/AiP...

Anyway, based on your suggestion I posted a quick ticket about adding support for the built-in PHP webserver:

https://github.com/indeyets/appserver-in-php/issues/17


From your very link: "This web server is designed for developmental purposes only, and should not be used in production."


I wish they would stop referring to their documentation as a "book." The keep calling the link to http://symfony.com/doc/current/book/index.html as their book, yet it offers no ebook manner of being accessed (my kingdom for a PDF.)

I can't help but wonder who this "book" is being marketed to because of this "you can only access the book while you're fully online" limitation.


Can someone comment on Symfony vs. CodeIgniter? I've done a few projects in CI - any big compelling reason to switch to Symfony for the next one?


CodeIgniter is a fundamentally PHP4 system that is, today, wedged into more modern PHP5.3 programming practices. Personally, I can't see a good reason to use CI today (and I say that as someone who has used it extensively in the past--my capstone project at school was based on it!). If you want something CI-esque, you're better off looking at Kohana...but Kohana seems to give short shrift to certain important aspects, e.g. security is something of an afterthought.

Symfony2, on the other hand, can be pretty safely termed a modern system: it's almost completely modular (and not in the "override some files, it's like magic!" method of Kohana or CI), expects modern programming practices (it doesn't treat you like an idiot; you can use PHP 5.3 stuff like anonymous functions and it's cool with it), and is blazingly, blazingly fast when configured properly.


I disagree with your view of CodeIgniter. It's one of the best documented frameworks out there; it's quick to learn; and it doesn't require a lot of typing/coding. It's best suited for smaller projects, I would say, but for those projects it rocks.


CodeIgniter's documentation is indeed very good. Much better than Symfony2's, at least. I'd agree with you on that.

CodeIgniter also has no conception of how to actually work in PHP5.3. Perhaps CodeIgniter will acquire that down the road, but right now it's a poor routing kernel surrounded by a lot of inconsistent and very ugly modules that are duplicated or improved upon in the other major frameworks in common use.

"Doesn't require a lot of coding" is nonsensical; I can build a Symfony2 application to do nontrivial task in less time, with better and more reliable code, than I can the equivalent in CodeIgniter. And I used CodeIgniter since around the time of the original release. There are not many cases where something is top-to-bottom dominant in its field, but aside from documentation, which is being improved upon incrementally, Symfony2 really does fit that bill.


There is also sfGuardPlugin, a great plugin for user management. It has everything about user management, easily integrates with symfony. Saves you so much time.


This is a symfony 1.4 plugin. A nice Symfony2 equivalent is FOSUserBundle (https://github.com/FriendsOfSymfony/FOSUserBundle).


Symfony has cool command line interface to set up projects, crud and all model classes etc. It also has backend admin genretor. There is no built in ajax and javascript function in codeigniter (But you can add it as plugin)


> Everything is a Bundle in Symfony2: A bundle is a directory containing a set of files (PHP files, stylesheets, JavaScripts, images, ...) that implement a single feature (a blog, a forum, etc). That changes everything. Share your bundles between your projects or publish them in the wild.

I have no idea whether this is novel, but it is to me, and I really like it.


Sounds a little like apps in Djangoland. Maybe someone who knows both frameworks could confirm.


This has been a core idea in both Midgard MVC and MidCOM PHP frameworks, though we called them components.

http://wiki.openpsa2.org/index.php/MidCOM_Components

https://github.com/midgardproject/midgardmvc_core/blob/maste...


I really hate why Django calls them 'apps'. Kinda difficult to distinguish between a working application or a Django 'app'.


I agree, I might have one 'app' that is what I consider my actual application, but then alongside it at the same level, something like Django OAuth. It would be a stretch to call django-registration or OAuth an 'app', since they can't do anything alone.


SilverStripe's Sapphire framework has had this for quite a while, if you wanted to use it, with their modules. If you're in the mood for being that organised it can be really helpful.


Very, very excited about this and have been for some time, congratulations to the team on the release! For those that don't know it, Symfony is a very impressive framework that puts a lot more into "Doing Things Right" than most other PHP frameworks, and some of their components (such as Assetic) are amazing contributions to the PHP ecosystem in their own right.


Well done to everyone involved, looking forward to checking out all of the new features.


I'd never heard of Symfony before. Can someone point to some tech details about the framework? The site does a lot of explaining what a framework is, and some general philosophies - but not what this particular framework is.


Symfony is a rather popular PHP framework; it is commonly regarded in the PHP community as one of the higher-quality frameworks (amidst many half-baked frameworks that cause serious problems once your use case moves past the blog tutorial).

In terms of functionality, it's basically for PHP what Rails is for Ruby, but unlike many other PHP frameworks, it's been designed with the platform in mind rather than trying to force Rails' concepts into PHP, as a result if which it feels "just better". This has given it an edge over competitors, which is why Symfony is remarkably popular among the more professional PHP businesses.

I think it's basically the only mature and popular surviving framework that dates from the blast of PHP frameworks that came to be when Rails got popular and PHP coders wanted that too.


Symfony is closer to django than to rails (in terms of APIs, I believe the project itself is built in a more modular manner) though, many of symfony's features are almost straight ports of django features, sometimes renamed.


are you saying Symphony is better than market leaders Zend and Cakephp and becoming more popular these days ,

isnt it so that its much easier to find a Zend plugins/libraries or Cakephp ready-made plugin/library than to find Symphony code snippets


I have not seen a greenfield, or even brownfield, CakePHP or Zend project in years, outside of $BigCo environments. Calling CakePHP in particular a "market leader" seems rather wrong.

Zend is well-written and solid, but old; it hasn't been materially upgraded for PHP5.3--which is all you should be using these days, there's no good reason not to.

Symfony2 can trivially use Zend-based components. (It does, for some tasks.) I've heard it wise-assedly called "ZF3" because of its compatibility in the past.


I'm not sure that CakePHP is any more a market leader than Symfony.


Same here. No Idea where this came from. To be honest the effort put into this could've just contributed to an existing open source framework for improvement.


You sound like a PHP coder telling DHH to stop doing Rails 3 and get working on some existing open source framework instead.

I know that HN is somewhat ignorant of the PHP community due to the large set of idiots there and the so not cool factor, but you're taking this to the extreme. Symfony is probably one of the most decent and most widely used pieces of open source PHP out there.


Sadly, Symfony/Symfony2 are not widely used enough. :/

(This may be a bit flippant, but seriously--there's not really a good reason to be using stuff like CakePHP, etc. in 2011.)


I may be in the process of updating a very neglected cakephp site. When I created the site, I had heard of Symfony but went with cakephp. I've not followed either framework for well over a year, so could you please give your reasons for Symfony and against cakephp?


CakePHP is fundamentally old. It does not avail itself of the capabilities offered in PHP5.3+ and persists in a number of outdated patterns that I consider detrimental to writing good, reusable, maintainable code. It is also incredibly slow, such that it is sort of the "gimme" for people wanting to write benchmarks to show how fast and awesome their new framework is.

Symfony2, on the other hand, is very well-designed (separating entirely from Symfony 1.3 to develop Symfony2 was a great decision), incredibly flexbile, and amazingly performant. It is, no exaggeration, the best PHP system I've ever seen, open-source or otherwise; unless you're Mr. Potencier, reading its code will make you a better PHP programmer. You can actually strip it down so far as to be just a microkernel + dispatch, which is what Silex[1] is. You can also built all manner of whatever-you-want on top of it. There's no real downside to using at least part of the Symfony2 ecosystem for any PHP project.

http://silex-project.org/


To my experience, Cake simply does not grow beyond their own blog tutorial.

Maybe they fixed this, but last time I used Cake, for instance, if you were overriding hooks in the Model to e.g. change the data as returned to the view/controller, you had to do this different depending on how the data was collected. So in the same hook method of the BananaPeer, you either got a single Banana, or an array of Banana objects, or an array with a key "Bananas" which had an array of Banana objects. There was no way to figure this out except with a lot of testing. There was no uniform way to implement standard features and constraints inside the model.

Cake was full of this kind of shit. It was, simply, horribly badly designed and to my impression only popular because its web site was pretty. The source code was horribly undocumented and the internal SQL query building process was a disaster.


Personally, I think that Cake was popular because it was one of the first frameworks out there. It's been surpassed by all sorts of folks (Symfony2 now chief among them).

I think that, next time someone asks me why Cake sucks, I'm just going to say "BananaPeer" over and over again.

Because bananas don't have peers.


I love it how I get marked down for a clean post with an opinion and you get a pass by declaring people idiots for just expressing their opinion. The way I see it the idiots seem to be on your side. Just learn to express your side of things without getting irritated. I am open to correction but insults I'd piss on.


The blog post gives some background.

Popularity:

Another way to understand the level of the community commitment is to compare it with other projects. Symfony2 is currently the most popular PHP project on Github (most forked and most watched overall) and the 12th most forked project for the whole Github platform. That's just astonishing!

Standards compliance:

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.

Caching:

By embracing the HTTP standard, and thanks to the ESI standard, you can make your application fly very easily. Make your application as dynamic as you need it to be, and still benefit from HTTP caching. And if you can afford the installation of a reverse proxy like Varnish, the performance of your application will just be incredible.


Bear in mind that ESI with Varnish is a tricky one! But it is very, very exciting to see a framework embracing it nonetheless.


Wait, what? Symfony 1 and Zend framework are 2 of the most popular frameworks for PHP. If you've never heard of it, you haven't been paying attention.


Careful; symfony has been around for a few years already.

Saying the effort should be put into some other framework is effectively turning the case upside down.


Exactly. It actually seems to go the way that various other PHP frameworks can be replaced with Symfony2.

There is already a compatibility bundle for running Zend Framework apps with Symfony2:

http://symfony2bundles.org/beberlei/WhitewashingZFMvcCompatB...

And I'm working on another bundle that allows running Midgard MVC apps:

https://github.com/bergie/MidgardMvcCompatBundle


Whoa, this is very cool. (I have a legacy Midgard MVC app I'd like to get rid of.)

Between Symfony2 and Silex, I'm not sure what case there is to use anything else anymore. It seems like the low and high ends are very well covered in the Sensio Labs environment, and I'm not sure how much room there is in the middle.


Ping me on Freenode #midgard and I can give you more info how to proceed. Out of curiosity, though: are you sure this is Midgard MVC and not MidCOM, the older MVC framework for Midgard?

Doesn't matter, though. We're building compatibility bundles for both. Though Midgard MVC is already in somewhat running state.


I stand corrected then.


Congrats to Symfony2 Team!

FYI, Symfony2 requires minimum PHP version 5.3.2

PHP 5.3 which is not something every shared hosting provider will support, most are still on 5.2.series. so everyone should keep that in mind while writing PHP app with Symfony2


I hear these sorts of things regarding hosting all of the time. However, in my experience, if you are working on an app that is large enough to warrant using a framework like Symfony or Zend Framework, you are probably going to also be using your own server. People don't build large expensive applications and then deploy to GoDaddy or something :)


Agree completely. CodeIgniter used to use this as an argument for supporting PHP4 (!!?!?!?), but it seems so bankrupt. I (anecdotal, I know) don't know a single person writing an application (what these frameworks are designed for) who would deploy to a classic shared hosting environment over a VPS or app cloud service.


have been using Symfony since 2007. Today it powers the backend and website of my gaming startup and we still love it very much. Project is still SF 1.4 though, would love to upgrade to 2.0 but that would be too much work right now as 2.0 changes alot of basic principles.


In the meantime Zend Framework folks are designing Zend Framework 2.0 for PHP 5.4. U mad symfony ? :)


I highly recommend Yii ( http://www.yiiframework.com/ ) for people looking for a PHP framework. I've never used Symfony so can't compare the two, but Yii has done everything I've asked of it.


I highly recommend Python for people looking into web development. I've never used PHP so can't compare the two, but Python has done everything I've asked of it.

(end joke)


someone should do a comparison between Symphony and Yii , what type of web applications is each of them more suitable ( plugins etc. considered )




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: