Wallogit.com
2017 © Pedro Peláez
A very minimal base class for a PHP dependency injection container with magic __get(), as described in http://dqxtech.net/blog/2014-06-13/simple-do-it-yourself-php-service-container, (*2)
Nothing in here is auto-generated. The methods that instantiate services need to be written manually in a class extending the parent container., (*3)
Providing an alternative implementation for a service only works by extending the container., (*4)
It is recommended to add @property tags in the class docblock of your container class., (*5)
This is the most basic container base class. Usually you only need this one., (*6)
This one has a __set() method in addition to the __get() method. Setting only works for services / values that are not already initialized., (*7)
The __set() allows to override specific services with actual objects, thus providing a cheap alternative to extending the container., (*8)
This container is designed for a special way to deal with circular dependencies, using stubs., (*9)
Usually this is not needed. You should either avoid circular dependencies (recommended, if you can), or use a proxy somewhere in the circle., (*10)