Learn the Laravel Service Container
summary
Starts from a broken checkout and builds a minimal Stripe payment provider, then shows stepwise refactors: constructor injection, letting Laravel auto-resolving create nested dependencies, and finally explicit bindings in AppServiceProvider to supply a string config like currency. Adds a PaymentContract interface so swapping to Paddle requires only one line in the provider. Demonstrates testing by storing fake instances in tests via the container and replaces Laravel’s MailManager with a custom class to set Postmark stream headers. All examples run live and work end to end.
AI-written summary · about
chapters (15)
- 0:00Titan consultancy intro
- 4:29Technical issues and greeting
- 5:32Speaker introduction
- 7:33Introduction to service container
- 10:03Creating dependencies manually
- 15:44Constructor injection issues
- 20:16Auto-resolving dependencies
- 23:23Explicit container binding
- 26:17Binding to interfaces
- 29:04Real-world binding examples
- 33:05Inversion of control summary
- 35:27Facades and fakes
- 39:00Testing with service container
- 44:09Extending core framework code
- 48:55Conclusion and resources
