Category : Uncategorized
What is Symfony?
Symfony is a PHP web application framework for MVC applications. Symfony is free software and released under the MIT license. The symfony – project.com website launched on October 18, 2005.
« Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community – all working together in harmony. »
The leading PHP framework to create websites and web applications. Built on top of the Symfony Components.
A set of decoupled and reusable components on which the best PHP applications are built on, such as Drupal, phpBB and eZ Publish.
A huge community of Symfony fans committed to take PHP to the next level.
Embracing and promoting professionalism, best practices, standardization and interoperability of applications.
What is Symfony 2?
Symfony2 is a full-stack web framework written in PHP. Some also add that this is an MVC framework. And some others add that this is a decoupled framework. This is all fine and correct. But my definition is a bit different. Let me tell you what it is and why I think it matters.
Symfony2 is really about two different things.
First, Symfony2 is a reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems.
Then, based on these components, Symfony2 is also a full-stack web framework.
Depending on your project and depending on your needs, you can either pick and choose some of the Symfony2 components and start your project with them, or you can use the full-stack framework and benefit from the tight integration it provides out of the box. And choosing between the two different approaches is really up to you.
Is Symfony2 an MVC framework?
If you look around, every single framework seems to implement the MVC pattern. And most of them are advertised as MVC frameworks… but not Symfony2. Have a look at the documentation, and you will see that the MVC pattern is only mentioned once or twice, but Symfony2 is never defined as being an MVC framework. Why?
Because I really don’t care whether Symfony2 is MVC or not. Probably because the MVC word is so overloaded and because nobody implements exactly the same MVC pattern anyway. The separation of concerns is all I care about. And if you like to call Symfony2 an MVC framework, then you should know that Symfony2 is really about providing the tools for the Controller part, the View part, but not the Model part. It’s up to you to create your model by hand or use any other tool, like an ORM. Of course, tight integration exists for the most well known ORMs like Doctrine2 and Propel; but they are optional dependencies. The Symfony2 core features do not and will never rely on any ORM.
The code is rock solid. The major Symfony2 components is the result of many years of work and the contributions of many developers.
If you have a look at the code, you will see the @api tag on some classes and methods. It indicates the public stable API. This tag means that a method (its name, its arguments, its return value) won’t change in any Symfony2 minor versions. If you are only using the stable API, your code will not need to be upgraded when you upgrade to a newer version of Symfony2. That’s a great selling point.
Last, but not the least, we try to be as secure as possible. We provide many security features in the components and we also take code security very seriously. And thanks to our great community, we have been able to conduct a security audit from a professional company. That’s something that is obviously not possible for smaller projects.
Here are some examples of software and libraries that are currently using some of the Symfony2 Components:
- Silex: BrowerKit, CssSelector, DomCrawler, EventDispatcher, HttpFoundation, HttpKernel, Routing, Form, Translation, Validator
- Goutte: BrowserKit, DomCrawler, CssSelector, Process, ClassLoader, Finder
- Behat: Console, DependencyInjection, EventDispatcher, Finder, Yaml, Config, Translation
- Assetic: Process
- Doctrine2: Console, Yaml
- Propel2: Console, ClassLoader, Yaml
- PHPUnit: Yaml
- FLOW3: Yaml
- Midguard CMS: most of them in their next version?
- phpBB 4: most of them?
- Drupal 8*: ClassLoader, HttpFoundation, HttpKernel?
The Symfony2 Components
Let’s see what those components can do for you. As of today, we have 21 of them and any of them can be used as a standalone library:
- Faster and less greedy
In the IT world, it is not a rare occurrence for people to become concerned with the performance of an application… once they reach the end of the project! That is, once everything has been designed at both the functional and technological level. Even if you were to take everything apart, performance optimization is no easy task.
On the other hand, Symfony2 was conceived from the start to be fast, with a strong emphasis on performance. By way of comparison, Symfony2 is about 3 times faster than Symfony Version 1.4 and Zend Framework 1.10, while also taking up 2 times less memory.
- Unlimited flexibility
Whatever your needs are, Symfony2 will be adaptable. Its dependency injector and the Event Dispatcher make it entirely configurable, with each of the bricks being fully independent. A 3-in-1 framework, of sorts:
1.Full Stack (complete version): you want to develop a complex application and you need many functionalities.
2.Brick by brick: you build your framework according to the functionalities that you will need.
3.Microframework: as a standalone, Symfony2 can also be used to develop a specific functionality in one of your projects. Without having to redevelop everything and without installing the entire framework, but only the specific brick that you need.
Permanence is also something that relates to long-term support. Today, this support is naturally provided by SensioLabs. But there is also an entire ecosystem that has grown up around Symfony since its launch: the community (mailing lists, IRC, etc.) and the many other service companies that have invested in the framework.
Lastly, it is also with a view towards sustainable development that Symfony is distributed under Open Source MIT license, which does not impose constraints and allows the development of Open Source as well as proprietary applications.
From the smallest brick to the complete core itself, everything is presented as a “bundle” (or plug-in in Symfony language) in Symfony2. Each bundle is intended to add functionality to the framework, of course, and each bundle can also be reused in another project or shared with the rest of the community.
In any case, the system of bundles allows everything to change within Symfony, including the core itself. Using the system’s interface contracts between bricks, the behavior of the framework thus can be changed at will, without requiring complete reconfiguration.
- Stable and sustainable
Developed by SensioLabs, major versions of Symfony are all supported for 3 years by the company. And even for life as far as security-related issues are concerned.
For even greater stability, the minor versions of Symfony2’s contract and interface are also guaranteed and compatibility between all minor versions will be ensured on the API defined by the public interfaces.
- The joy of developing
As a highly functional environment, Symfony2 also guarantees a certain comfort level for developers. By taking care of a number of unpleasant tasks (development of minor functionalities, for example), Symfony2 allows developers to focus on the actual highlights of an application and to both fully validate their role and improve their productivity.
Among Symfony’s tools designed to make the life of a developer much easier, there is the legendary Web Debug Toolbar, as well as native support for development environments, detailed error pages or even native security.
- Ease of use
Completely flexible to satisfy the needs of professionals and advanced users alike, Symfony2 is also very accessible. Plentiful documentation, community and professional support, and “embedded” best practices within the framework (best practices that are natively applied without having to be aware of them or understanding them) allow a beginner to very quickly feel at ease with Symfony.