ramblings on PHP, SQL, the web, politics, ultimate frisbee and what else is on in my life
Do you want DIC with that Controller?
At Liip "Symfony2" started in production a year earlier. Well I say "Symfony2" because it was just our internal framework OkAPI enhanced with the current crop of at the time PHP 5.2 Symfony components (actually we also included the symfony 1.x routing component). The results were so convincing that we decided to switch to Symfony2 entirely. The big feature back then and today is of course dependency injection (DI) and the dependency injection container (DIC). I remember many discussion with Jordi back then, where we went back and forth on if Controllers should be configured in the DIC or not. In the end we did go with making Controllers DIC services. The other alternative is of course to instead just inject the entire DIC and let the Controller pull whatever services it needs straight from the DIC.
Play nice when extending \Exception
This is just a short follow up to a recent tweet of mine. I have seen this repeatedly happen, even to top notch and usually very careful developers (*). I am not sure why this mistake happens so frequently, but quite often you see code that changes the parameter order for custom Exception constructors. I guess it's mostly because in these cases the developer wants to pass some magic parameters that contain the message (and potentially also the code). Another scenario is adding a new required parameter. In both cases don't! Thanks.
Symfony2, what I think is still left to do
The goal of this blog post is to number one serve me as a todo list of stuff that I personally think needs to be fixed before Symfony2 can be released. Hopefully it will also entice some people to help out with these tasks. I am focusing on the medium to large tasks. There are of course still a fair number of smaller fixes that need to be applied.
Me and Symfony2 learning about REST
I hate the frontend. Maybe its just all the scars from the IE4 and IE6 days I had to suffer through, but since then I have taken every opportunity to move myself further away from the frontend. Database-land seemed equally ridden with incompatibilities but for some reason I coped better with that. Anyway, somehow this entire REST thing seemed frontend to me. I think at some point I ended up with the misconception that REST is about URLs. Mea culpa. Thanks to Fabien and his advocacy around learning the HTTP protocol and ESI, I took a second look and realized that there is a lot more to it and that one should care regardless of one considers oneself a frontend or backend guy. Independently I did develop an interest in being able to easily return content in different formats, which let to the creation of the ViewBundle and the MultiplexBundle. but now I am actually trying to learn what REST is all about. And while I am at it, I am teaching Symfony2 as well, et voilą RestBundle!
Symfony2 community pushing the PHP ecosystem
Even if you don't care about Symfony2 or Silex and instead prefer some other framework, there is stuff to benefit from going on inside the Symfony2 community. Not only are the Symfony2 components all build to also work standalone, but key contributors are also building libraries and tools that should proof useful for the entire PHP ecosystem. For an overview of the components part of Symfony2 I refer you all the Symfony2 site. Here is a short overview in alphabetical order of libraries that have spawned around Symfony2 (and just to clarify not at all focused on just Symfony2). Common to all of them are that they require PHP 5.3 and follow the PSR-0 for class loading.