Skip to main content
InterviewHubPRO
Section Overview
Q6

Question 6 of 50

Part 1: Architecture, Service Container & Request Lifecycle (1 - 10)

12%
Laravel & Ecosystem (50 Qs)•Part 1: Architecture, Service Container & Request Lifecycle (1 - 10)

What is the difference between `bind`, `singleton`, and `scoped` in Laravel?

senior LevelLifecycleDocker & ContainersSystem Design

In Simple Words:

  • $this->app->bind(Interface::class, Concrete::class): Returns a brand new instance every single time the class or interface is resolved.
  • $this->app->singleton(...): Instantiates the object once on the first resolution, caching and reusing that exact same instance for subsequent calls during the request.
  • $this->app->scoped(...): Similar to singleton within a single request, but resets automatically between requests in persistent long-running environments like Laravel Octane.