This week we are blogging the results of our evaluation of the popular PHP framework called Symfony. This is the next blog in our PHP Frameworks Comparison Series. Symfony was created by the French web development company SensioLabs for use on their clients’ projects. It was initially released to the public as an open source project in 2005.
Our evaluation is based on criteria we established in our overview blog. Read on…
The creators of Symfony promote the idea that it is not merely a framework, but also a philosophy and a community. The “philosophy” behind Symfony is that it is created by application developers for their own needs. I believe this is true of most open-source frameworks – but the Symfony folks seem to want to make a big deal about it.
The “community” is made up of the core team at SensioLabs, plus volunteer developers who also make contributions to the project. Again, this is not really a unique selling proposition – because this is something that just about every successful open source PHP framework project has.
I suspect the popularity of Symfony boils down to two factors:
• It is well marketed. The SensioLabs people know what they’re doing and promote Symfony with a lot of effort and sophistication. Most software developers and other types of technical people underrate the importance of marketing – but SensioLabs does not.
• It is a high quality product. More importantly, however is that most things within the framework are done very well. There are fewer malfunctions of the type that are “blockers” – bugs requiring hours of grueling research to solve or work around. The debug toolbar is beautiful. The attention to detail in these matters makes it more pleasurable to use.
Category 1: Core Framework Design:
Symfony is in its second major version and uses many of the best practices and techniques to make it quick to get started and powerful to accomplish your goals.
1. MVC support
Symfony is based on the MVC design pattern, it separates models from views and the work is orchestrated through controllers.
2. Thin controllers
Symfony allows for the creation of thin controller methods and can do all the required actions outside the controller using services and helpers.
3. Exception handling at framework level
Symfony comes with a default error handler which catches all errors from the framework, but a developer can extend this functionality and/or create custom error pages to meet any specific requirements.
4. Inheritable configuration with respect to environments and installation across servers
Symfony has this. In addition, there is flexibility on how you organize your configurations – allowing for different strategies for different applications.
5. Overhead required to create basic module configuration
There is very little overhead when using the CLI tool and Doctrine.
6. PHP 5.5+ support
This is supported.
7. Event management framework
Symfony has a robust event management system with the ability to configure dispatchers, listeners and subscribers.
8. Dependency injection support
It supports dependency injection through the Service Container.
9. Ease of bootstrapping and integrating with PHPUnit
Symfony includes PHPUnit. Unit testing is made as easy as it can be.
10. UI templating support
It utilizes Twig for templating.
11. Command Line Interface (CLI) to execute applications
Available using the Console Component.
12. Support for manipulation of various data formats like JSON and XML
JSON and XML are fully supported.
13. Useful debugging tools – such as logger support with customizable log levels, DB call instrumentation and request parameter logging.
All of these are available and can be accessed using the Web Debug Toolbar.
Category 2. Performance, Scalability and Redundancy
Symfony has the performance features that are common in PHP applications.
1. Support for application caching
Symfony supports caching using Memcache, Redis and Varnish.
3. Proven adoption on large projects
Many large projects are known to be built on Symfony.
Category 3. Security
Symfony’s authorization and authentication controls are quite robust.
1. Modules for security such as authentication, authorization and granular access controls
Authorization, authentication and access control lists are all included. It uses Best practices for password salting and hashing.
2. Frequent security patching
Symfony is actively maintained and security patches are released regularly.
Category 4. Instrumentation and Troubleshooting support
Great care has been given to make the Web Debug Toolbar attractive and functional. It is one of the reasons Symfony is popular with developers.
1. Instrumentation metrics or accessibility at the method level
Xdebug can be used to achieve this.
2. Instrumentation metrics or accessibility at the SQL level
Sql queries can be monitored from the Web Debug Toolbar. Further analysis can be done with third-party tools.
Category 5. Database and Object-Relational-Mapping (ORM) Support
Symfony supports Doctrine which makes ORM and database access simple to start and robust enough to do exactly what you need.
1. Support for models that interact with relational databases used at the client, specifically MySQL and Oracle, and possibly MariaDB in the future
Symfony supports all of these.
2. Support for fine tuning of the SQL used in the ORM
3. Support for interaction with NoSQL databases like MongoDB
Yes, it definitely support this
Category 6. Community Support
I usually find answers to my questions quickly and painlessly. To me, that is indicative of great community support.
1. Active maintenance and periodic releases
Symfony is on its second major version. It is actively updated and maintained.
2. Large developer community, support and discussion forums
There are a lot of resources online.
3. Ability to run on a wide variety of Linux and Unix platforms such as RedHat, CentOS, Ubuntu, and MacOS
Since it is a PHP framework, it can run on all supported operating systems
4. Well documented – up-to-date with current release
Great documentation for each release, making it easy to learn.
Overall, Symfony is a good, safe choice for your PHP application. In the old days, they used to say that “Nobody ever got fired for choosing IBM.” Choosing Symfony for your next PHP application is also a decision that you’re not likely to regret.