September 2017
Intermediate to advanced
244 pages
6h 44m
English
A service container is a tool provided for dependency injection and dependency resolution. Developers just tell which class should be injected where, and the service container resolves and injects that dependency.
Dependency injection can be used for resolving any dependency of a class if its object is created through the application service container, not through the new keyword in the application.
For example, the Lumen service container is used to resolve all Lumen controllers. So, if they need any dependency, the service container is responsible for resolving that. For better understanding consider the following example:
class PostController extends Post{ public function __construct(Post $post ...Read now
Unlock full access