Slim Framework + Symfony Dependency Injection
Over too many years writing PHP code, there have been many Aha! moments. One of them was the discovery of Dependency Injection (DI). It's something I now use on all projects. I've also become a great fan of the Slim framework, which has always had a cut down DI container at it's heart.
The problem starts when you are writing complex systems and after trying many DI implementations, I have for the last few years favoured the Symfony DI container, principally because of it's very straightforward implementation and powerful XML definition option.
So it came to pass that I had a challenge to produce something very quickly that I knew would end up in production even though it was supposed to be a prototype. Slim is perfect for prototyping, but can happily be used to drive full blown applications. What I needed however was the ability to quickly transfer the prototype code if necessary to some other framework;
enter the DI! After hand stitching in the Symfony DI, it occurred to me that this something I might want to do in the future. You can find the results in the Slimdic repo
As it happened, the prototype did go into production, with Slim driving it. But if I'd had to move the code to some other framework, it would have been so much easier to lift the code + DI definition.
Some DI PHP implementations: