Laravel theorytheory 0/50 · 0%
Architecture · easy

16. Service Container

Laravel's dependency injection tool.

The service container is a powerful tool for managing class dependencies and performing dependency injection. Laravel automatically resolves and injects type-hinted dependencies in constructors and controller methods. You can also manually bind interfaces to implementations using app()->bind() or the container's singleton() method.

Check your understanding

  1. 1. What does bind() vs singleton() control in the container?

  2. 2. How are dependencies typically injected into a controller?