Last week, I held a keynote presentation about Symfony2 at the Symfony
Day conference in Cologne. Many people asked me for
the slides, but they were quite empty and not that useful. This blog post is
more or less what I've said during the first part of the talk.
What is Symfony2?
When I ask people what Symfony2 is for them, most of them say something along
the lines of: 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.
I don't like MVC because that's not how the web works. Symfony2 is an HTTP
framework; it is a Request/Response framework. That's the big deal. The
fundamental principles of Symfony2 are centered around the HTTP specification.
I don't like MVC because the web has evolved a lot in the recent years and
some projects are much different than projects we had some years ago.
Sometimes, you just need a way to create a REST API. Sometimes, the logic is
mostly in the browser and the server is just used to serve data (think
backbone.js for instance). And for these projects, you don't need an MVC
framework. You need something that handles a Request and returns a Response.
You need a framework that implements the HTTP specification. HTTP streaming is
yet another example that does not fit well with the MVC pattern.
Why does it matter?
We need to better advertise Symfony2 as a set of reusable components because I
strongly believe that the community growth in the coming years will mainly
come from the adoption of the components.
And Symfony2 adoption is all about how we sell the project. But it's also
about the perception of the project people have. And as symfony 1.0 was mostly
a monolithic framework, a lot of people still think that Symfony is indeed a
monolithic framework. Hopefully, with the release of Symfony2, the perception
is a bit different now, but it will definitely take a lot of time to change
people minds.
It matters because even if new frameworks are created every single day, I
think that in the "enterprise", there is room for only 2 or maybe 3 PHP
frameworks. The question is: how will we win the framework war competition?
First, we need to lead the pack technically by constantly innovating. Getting
inspiration from other technologies, other frameworks, and other web languages
and adapting some of their concepts to PHP is a key factor here. Acknowledging
that the web evolves is also very important. And Symfony2 is probably a great
step forward in this direction with many great innovations like bundles, HTTP
caching, distributions, dependency injection, templating engines, annotation
configuration, asset management, the stable API, the web profiler, and a bunch
more.
We will win the framework war competition if Symfony2 is everywhere. And a full-stack
framework will never become a standard in the PHP world. So, we need to find
another way.
Being everywhere is about sharing. First, by not reinventing the wheel
ourselves and by inte
Truncated by Planet PHP, read more at the original (another 33381 bytes)