O'Reilly logo

Modernizing Legacy Applications in PHP by Paul M. Jones

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 16. Add a Dependency Injection Container

We have reached the final step in our modernization process. We will remove the last vestiges of our page scripts by moving their remaining logic into a dependency injection container. The container will be responsible for coordinating all the object creation activity in our application. In doing so, we will modify our front controller again, and begin adding routes that point to controller classes instead of file paths.

Note

For this final step in the modernization process, it is best if we have PHP 5.3 or later installed. This is because we need closures for critical parts of the application logic. If we do not have access to PHP 5.3, there is a less viable but still workable option for implementing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required