Laravel Design Patterns
summary
Covers four concrete patterns with PHP and Laravel code: Factory for views and validators, Builder/Manager showing createDriver/createXDriver behavior used by Mail and Hasher, Strategy via translation loaders (switching to an array loader to speed tests), and Provider via package service providers like Debugbar. Digs into framework source, shows the exact methods and config switches, and demonstrates working examples and when each pattern actually simplifies swapping implementations.
AI-written summary · about
chapters (25)
- 0:00Intro
- 1:52Laravel Design Patterns
- 2:28Daily Design Patterns
- 2:54What are Design Patterns?
- 3:14Design Patterns are ... Recipes for building maintainable code
- 3:38Be your own Chef Using the boundaries of Design Pattern
- 4:09Why use Design Patterns?
- 6:57Design Pattern Time
- 7:10Creational Patterns - Class instantiation - Hiding the creation logic – Examples Factory, Builder, Prototype Singleton
- 7:30Structural Patterns - Composition between objects -Usages of interfaces, abstract classes – Examples: Adapter Bridge, Decorator, Facade, Proxy
- 7:57Design Patterns in Laravel
- 10:34Factory Pattern Example
- 11:07Factory Pattern Laravel Example
- 13:26Builder (Manager) Pattern
- 15:45Builder Pattern Example
- 18:16Builder Pattern Laravel
- 27:34Strategy Pattern Laravel Example
- 31:17Provider Pattern Sets a pattern for providing some essential service
- 31:54Provider Pattern Example class DominosServiceProvider extends ServiceProvider public function register()
- 34:00Provider Pattern Laravel Example
- 34:59Factory Pattern Recap Factory translates interface to an instance
- 35:19Builder Pattern Recap Builder Pattern can do the configuration for a new object without passing this configuration to that object
- 35:45Strategy Pattern Recap Strategy pattern provides one place where the correct strategy (algorithm) is called
- 36:25Provider Pattern Recap Provider Pattern let you extend the framework by registering new classes in the container
- 37:42Want to learn more?
related talks
21mSoftware Design Patterns in Laravel 4
32mDesign Patterns and Packages for Excellent Laravel Backoffices
44mAbusing Laravel for Fun and Profit
37mOrganizing Code in Laravel
02h 24mPractical design patterns in PHP (Part 1)
31mModern PHP development with Laravel 5.6
49mLaravel - If, how and why you should use it!
38mCrafting maintainable Laravel applications
