Download the PHP package lorisleiva/laravel-actions without Composer
On this page you can find all versions of the php package lorisleiva/laravel-actions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
All versions of laravel-actions with dependencies
Informations about the package laravel-actions
⚡️ Laravel Actions
⚡ Classes that take care of one specific task.
This package introduces a new way of organising the logic of your Laravel applications by focusing on the actions your application provide.
Instead of creating controllers, jobs, listeners and so on, it allows you to create a PHP class that handles a specific task and run that class as anything you want.
Therefore it encourages you to switch your focus from:
"What controllers do I need?", "should I make a FormRequest for this?", "should this run asynchronously in a job instead?", ect.
"What does my application actually do?"
:books: Read the full documentation at laravelactions.com
Create your first action using
php artisan make:action PublishANewArticle and define the
asX methods when you want your action to be running as
As an object
Now, you can run your action as an object by using the
run method like so:
As a controller
Simply register your action as an invokable controller in a routes file.
As a listener
Simply register your action as a listener of the
asListener method of your action will be called whenever the
NewProductReleased event is dispatched.
On top of running your actions as objects, controllers and listeners, Laravel Actions also supports jobs, commands and even mocking your actions in tests.