What are contracts or interfaces in Laravel?
Answer
Clear, interview-ready explanation
Laravel contracts are interfaces that define the capabilities of core framework services, such as queues, mail, cache, and filesystem access. They specify what a service can do without requiring a class to depend directly on one concrete implementation.
A class can type-hint a contract and let the service container inject the configured implementation. This makes dependencies explicit and can make swapping implementations or testing with fakes easier. Application-specific interfaces follow the same principle when multiple implementations or a stable boundary are genuinely useful.