In frameworks like Laravel or Symfony, what is the difference between the 'Service Container' and a 'Service Provider'?

Last updated 15 June 2026

  • The Service Container is the IoC registry that resolves classes and builds their dependency graph (e.g. app(PaymentGateway::class)).

  • A Service Provider is where bindings are registered: register() binds into the container, and boot() runs after all bindings exist.

  • Providers write the recipes and the container cooks the meal when something is requested.

  • https://medium.com/@pritesh.kody/difference-between-service-provider-and-service-container-in-laravel-e4e095e7ca2a
  • https://zerithonlabs.com/blog/laravel-service-container-service-provider-practical-example
  • https://laravel.com/framework/docs/9.x/providers
  • https://blog.kishanrank.com/service-container-vs-service-provider-in-laravel/
  • https://laravel.com/framework/docs/11.x/container
  • https://symfony.com/doc/current/service_container.html
  • https://symfony.com/doc/current/service_container/extensions.html
  • https://symfony.com/doc/current/service_container/compiler_passes.html
All PHP interview questions