The Laravel Actions Pattern: Single-Purpose Classes That Do One Thing Well
Replace fat controllers and bloated services with focused Action classes. One class, one job, fully testable. A modern alternative to the Service-Repository pattern.
6 articles
Software design patterns implementation in PHP/Laravel. Explore Repository, Service, Strategy, Factory, and other patterns for better code organization.
Replace fat controllers and bloated services with focused Action classes. One class, one job, fully testable. A modern alternative to the Service-Repository pattern.
Learn Event Sourcing and CQRS patterns in Laravel with Spatie's event-sourcing package. Build an audit trail, replay events, and separate read/write models.
When a Model has too many states (Pending, Paid, Shipped...), code gets flooded with if/else. The State Pattern helps encapsulate state transition logic elegantly.
Implement a robust payment system supporting Stripe, PayPal, and others using the Strategy Design Pattern. Learn to switch gateways dynamically without messy if-else statements.
Refactor complex business logic into maintainable, distinct steps using Laravel's Pipeline utility. Perfect for checkouts, data processing, and workflow management.
Understanding the heart of the framework. Dependency Injection, Binding, and how Laravel builds your application.