Dad, how are Service Containers born?
summary
Shows how to implement a minimal PHP service container using test-driven development with PHPUnit and Reflection to add auto-wiring, abstract-to-concrete bindings, singleton bindings, and closure factories. The implementation resolves recursive constructor dependencies, returns bound implementations or shared singleton instances, and executes closures; tests for each feature are shown and compared to Laravel's container.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 2:25Service Container evolution
- 3:52Service Container definition
- 5:15Direct dependency issues
- 8:05Dependency Injection & SOLID
- 9:25Service Container binding
- 10:29Interface dependency resolution
- 14:23Service Container features
- 16:52TDD demo
- 27:27Recursive dependency resolution
- 39:36Singleton handling
- 44:42Closure binding
- 48:25Summary
- 49:28Q&A
related talks
38mIOC container beyond constructor injection
02h 23mMastering Symfony 4's Dependency Injection
27mDemystifying Dependency Injection Containers
21mSoftware Design Patterns in Laravel 4
49m"Deep Dive into Symfony's Dependency Injection Component"
25mDocker for PHP Developers
02h 14mRunning PHP in Docker containers
36mAn Introduction to OOP, Design Patterns, and TDD
