Why PHP and Symfony, and not Java?
We are often asked, especially from our enterprise customers at financial institutions, why we decided to go with PHP and Symfony instead of a Java framework. And as we have actually re-considered alternatives both in 2007 and 2011, we know the answer pretty well. We also know firsthand how much PHP and the PHP ecosystem has matured and progressed the last few years, how Symfony2 and Composer provided a big jump forward, how PHP v7 and Symfony3 is positioned to provide the next, in the end making us very confident in our choice and in recommending it to others. Read-on if you're interested in the topic!
Modern PHP in Comparison to Java
Why are Symfony and PHP today an increasingly viable alternative to Java and Java Frameworks?
The whole PHP vs Java argument is as old as both languages themselves, however most arguments found online for -- or against -- are out of date, and not really valid anymore:
- Some will dismiss PHP for being a script language, but the truth is, PHP and its ecosystem has adopted more and more advanced language and framework features over time. For instance PHP has gained organizational features like namespaces, optional type declarations, rich Object Oriented Programming model and much more. The PHP ecosystems on its side have matured greatly, especially over the last 5+ years. While already offer strong testing, domain-driven design and quality-centric culture, the introduction of Composer for package management resulted in a culture of reuse of best of breed packages, which pushed collaboration across projects like Symfony to a new level.
- Some places you’ll see arguments that Java is more scalable, but over the last 10 years companies like Facebook, Wikipedia, Yahoo, Spotify, Zynga, and many more, have proven that PHP can scale, and does so exceptionally well horizontally.
- Other places will talk about PHP's performances being bad. However, today you can also run PHP code on Facebook’s HHVM, a VM working much like JAVA virtual machine, with similar performance properties. On the PHP side, the 5.x series improved performance over the last 10 years more than four times. And with PHP v7 arriving later this year, performance will be more than doubled, making it on pair with Facebook's HHVM implementation. Besides, for web applications, making sure your database and other backend systems performs well, has always been the first optimizations you should take care of, not the language itself.
- Other arguments are poor tools support. Yet, by now PHP is widely supported by IDE’s (example: PhpStorm by JetBrains), and also has lots of debugging tools and profiling services like SensioLabs Blackfire, and others like Tideways. PHP is well supported by Continuous Integration services like Travis, and has several competing xUnit testing tools like PHPUnit, and spec tools like Behat (BDD) and phpspec.
We could go over more technical arguments for or against, but regardless when picking a technology, you should always look at what skills your team has first. Remember, it is not just about the technology. Your team is what makes your web application scale, perform, and run without downtime.
Symfony Frameworks compared to Java Frameworks
The final paragraph above still stands in this comparison as well. Symfony2, introduced in 2011 after 2 years of active community development, took a lot of inspiration from Spring Framework, maybe the most popular Java framework out there.
It is organized as a set of reusable components and bundles which together makes up a full stack framework giving you a lot of features out of the box. It does not contain database or NoSQL backends, however there are several high quality Symfony bundles out there that provide this and other unique functionality, or extend symfony to be even more powerful. Again, all this is something you will also find in in popular Java Frameworks and in the Java community.
Unique advantages of Symfony Framework
However, this is where the similarities end and some of the unique advantages of Symfony Framework and PHP start to emerge:
- PHP is the largest development language on the web providing you with a big pool of developers of all skill levels that can potentially work with you on your project. All the way from beginner developers that are working on making sites or plugins for Wordpress and Drupal to senior engineers contributing to Symfony with a blindfold -- and everyone in between.
- Symfony has a vibrant and growing community. With eZ Platform (uses Symfony Full Stack), Drupal 8 (uses many Symfony Components) and Symfony3 coming out later this year, this will continue.
- Symfony, just like PHP itself, is truly an open source project. It does not rise or fall on the account of one vendor backing the project.
- Symfony2 introduced truly unique HTTP and HTTP cache handling by being an HTTP-centric request/response framework, and also by allowing full use of advance features like ESI for separating the different parts of your page/application. Symfony2 is powered out of the box by a fast PHP-built Symfony reverse proxy, and for mid- to large-installations a seamless upgrade to Varnish provides a 10-20x speedup, and a far more robust cache handling.
Like all things, the impact of a decision such as ours can be weighed and measured more accurately overtime, but we feel our decision to first use PHP, then choose Symfony was the right one. We have already received great feedback from the community and our customer base, which has been instrumental in all of our decisions from a development standpoint.
A bit later this year we will blog more about additional unique advantages of adding eZ Platform on top of Symfony, however even without all of those we hope new partners and developers will understand and take advantage of the many benefits the PHP + Symfony software stack provides. Please feel free to share your views (and possible disagreements) on the topic in the comment section below!
Discover the full power of the eZ Publish Platform: get trained, certified and recommended by eZ Systems > Become an eZ Business Partner now!