Over the last few years, the PHP ecosystem’s really kicked it up a gear when it comes to good application design, unit testing and dependency management. Unfortunately, some of us are still stuck working with code that’s 5 years old and has never heard of dependency injection. How can we use all these wonderful new tricks when our existing codebase is so bad?
There are ways to do it. Some of them aren’t pretty, and some of them feel plain wrong, but they mean that your code is at least a little bit more stable than they were before you started. Over the last 12 months I’ve been on a mission to improve a legacy code base. This includes eradicating singletons and reducing the dependencies of our unit tests (no need to connect to a DB any more!). Let me help you do the same for your code base too.