lorisleiva/laravel-actions
Laravel Actions organizes your app around single-purpose “action” classes. Write the core logic once in handle(), then run it as a controller, job, listener, command, or plain object. Keep business logic reusable, testable, and consistent across entry points.
PublishArticle action can be reused as a controller, job, or event listener without rewriting core logic.make:action command auto-generates test stubs, cutting test setup time.CreateUser::asController()).SendWelcomeEmail::asJob()).UserRegistered::asListener()).php artisan generate:invoice → GenerateInvoice::asCommand()).Adopt if:
handle() methods in Jobs/Controllers).Look elsewhere if:
"Laravel Actions lets us build faster and maintain cleaner code by replacing spaghetti controllers with focused, reusable ‘action’ classes. Think of it like LEGO blocks: instead of wiring up validation, jobs, and APIs separately, we define what the system does (e.g., ‘publish an article’) once, then reuse it anywhere. This cuts development time by 30%+ in our tests and makes the codebase easier to scale—critical for our [roadmap goal: modular monolith by Q3]."
ROI:
handle() logic).*"This package eliminates the ‘where does this logic go?’ problem by letting us define actions as standalone classes. For example:
ArticleController with PublishArticle::asController().SendEmailJob to SendWelcomeEmail::asJob().UserRegistered::asListener() to events.Key benefits:
handle() method).Migration path:
Trade-offs:
Next steps:
PublishArticle vs. ArticlePublisher)."*How can I help you explore Laravel packages today?