Practical design patterns in PHP (Part 1)
summary
One-and-a-half day workshop covers about 10–12 design patterns with hands‑on PHP: uses Composer, moneyphp/money, ramsey/uuid and phpunit, plus an assertion library to guard inputs. Builds a small webshop domain (Product interface, PhysicalProduct, ComboProduct) implementing the Composite and later Decorator patterns, writes PHPUnit tests that run and pass, and shows factories/value‑objects (Money, UID, Weight) and how composition replaces brittle inheritance.
AI-written summary · about
chapters (18)
- 0:00Introduction
- 0:40Dependency injection
- 6:50Object composition
- 12:30Single responsibility
- 17:50Extensibility
- 22:00Substitution principle
- 25:40Interface segregation principle
- 28:30Interface dependency inversion principle
- 29:40Object calisthenics
- 32:25Primitive types and strings
- 37:40One level of indentation
- 40:30Avoid else keyword
- 41:10No statements
- 43:15Avoid public accesses
- 49:45Collections
- 52:50Value Objects
- 56:35Money Objects
- 58:30Money PHP
related talks
21mSoftware Design Patterns in Laravel 4
36mAn Introduction to OOP, Design Patterns, and TDD
38mLaravel Design Patterns
45mBeyond design patterns and principles - writing good OO code
25mDesign Patterns Unleashed: Building Elegant and Confident Solutions
40mBarely Enough Design
45mGetting started with test-driven development with PHPUnit
58mObjects, Testing and Responsibility
