PHPackages                             lorisleiva/laravel-actions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. lorisleiva/laravel-actions

ActiveLibrary[Queues &amp; Workers](/categories/queues)

lorisleiva/laravel-actions
==========================

Laravel components that take care of one specific task

v2.10.1(2mo ago)2.8k7.5M—7.6%138[24 issues](https://github.com/lorisleiva/laravel-actions/issues)[8 PRs](https://github.com/lorisleiva/laravel-actions/pulls)20MITPHPPHP ^8.2CI passing

Since May 19Pushed 2mo ago33 watchersCompare

[ Source](https://github.com/lorisleiva/laravel-actions)[ Packagist](https://packagist.org/packages/lorisleiva/laravel-actions)[ Docs](https://github.com/lorisleiva/laravel-actions)[ GitHub Sponsors](https://github.com/sponsors/lorisleiva)[ RSS](/packages/lorisleiva-laravel-actions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (83)Used By (20)

⚡️ Laravel Actions
==================

[](#️-laravel-actions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/df4e4d6345d9ffca09c2c3e52c2326ab05768d52ef625b2a4eea07296e0816b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f7269736c656976612f6c61726176656c2d616374696f6e732e737667)](https://packagist.org/packages/lorisleiva/laravel-actions)[![GitHub Tests Action Status](https://camo.githubusercontent.com/977dbea60770cd2ed6c5a30f7327972e9c4165d7eb17f5cc45642dc6dfd75025/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6f7269736c656976612f6c61726176656c2d616374696f6e732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e)](https://github.com/lorisleiva/laravel-actions/actions?query=workflow%3ATests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/67168e5dded0b155314e91e25ef68b05774885b76d354d8b65511a2ace0a78d2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6f7269736c656976612f6c61726176656c2d616374696f6e732e737667)](https://packagist.org/packages/lorisleiva/laravel-actions)

[![hero](https://user-images.githubusercontent.com/3642397/104024620-4e572400-51bb-11eb-97fc-c2692b16eaa7.png)](https://user-images.githubusercontent.com/3642397/104024620-4e572400-51bb-11eb-97fc-c2692b16eaa7.png)

⚡ **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 applications 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?", etc.

to:

> "What does my application actually do?"

Installation
------------

[](#installation)

```
composer require lorisleiva/laravel-actions
```

Documentation
-------------

[](#documentation)

📚 Read the full documentation at [laravelactions.com](https://laravelactions.com/)

Basic usage
-----------

[](#basic-usage)

Create your first action using `php artisan make:action PublishANewArticle` and define the `asX` methods when you want your action to be running as `X`. E.g. `asController`, `asJob`, `asListener` and/or `asCommand`.

```
class PublishANewArticle
{
    use AsAction;

    public function handle(User $author, string $title, string $body): Article
    {
        return $author->articles()->create([
            'title' => $title,
            'body' => $body,
        ]);
    }

    public function asController(Request $request): ArticleResource
    {
        $article = $this->handle(
            $request->user(),
            $request->get('title'),
            $request->get('body'),
        );

        return new ArticleResource($article);
    }

    public function asListener(NewProductReleased $event): void
    {
        $this->handle(
            $event->product->manager,
            $event->product->name . ' Released!',
            $event->product->description,
        );
    }
}
```

### As an object

[](#as-an-object)

Now, you can run your action as an object by using the `run` method like so:

```
PublishANewArticle::run($author, 'My title', 'My content');
```

### As a controller

[](#as-a-controller)

Simply register your action as an invokable controller in a routes file.

```
Route::post('articles', PublishANewArticle::class)->middleware('auth');
```

### As a listener

[](#as-a-listener)

Simply register your action as a listener of the `NewProductReleased` event.

```
Event::listen(NewProductReleased::class, PublishANewArticle::class);
```

Then, the `asListener` method of your action will be called whenever the `NewProductReleased` event is dispatched.

```
event(new NewProductReleased($manager, 'Product title', 'Product description'));
```

### And more...

[](#and-more)

On top of running your actions as objects, controllers and listeners, Laravel Actions also supports jobs, commands and even mocking your actions in tests.

📚 [Check out the full documentation to learn everything that Laravel Actions has to offer](https://laravelactions.com/).

###  Health Score

78

—

ExcellentBetter than 100% of packages

Maintenance88

Actively maintained with recent releases

Popularity73

Solid adoption and visibility

Community50

Growing community involvement

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 88.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~36 days

Recently: every ~102 days

Total

70

Last Release

60d ago

Major Versions

v0.3.0 → v1.0.02020-05-08

v1.2.2 → v2.0.02021-01-08

PHP version history (5 changes)v2.0.0PHP ^7.4|^8.0

v2.2.0PHP ^8.0

v2.5.0PHP ^8.0|^8.1

v2.8.0PHP ^8.1

v2.10.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3642397?v=4)[Loris Leiva](/maintainers/lorisleiva)[@lorisleiva](https://github.com/lorisleiva)

---

Top Contributors

[![lorisleiva](https://avatars.githubusercontent.com/u/3642397?v=4)](https://github.com/lorisleiva "lorisleiva (441 commits)")[![mortenscheel](https://avatars.githubusercontent.com/u/6514342?v=4)](https://github.com/mortenscheel "mortenscheel (19 commits)")[![patrickomeara](https://avatars.githubusercontent.com/u/571773?v=4)](https://github.com/patrickomeara "patrickomeara (3 commits)")[![Wulfheart](https://avatars.githubusercontent.com/u/25671390?v=4)](https://github.com/Wulfheart "Wulfheart (3 commits)")[![edwinvdpol](https://avatars.githubusercontent.com/u/9265514?v=4)](https://github.com/edwinvdpol "edwinvdpol (2 commits)")[![jaulz](https://avatars.githubusercontent.com/u/5358638?v=4)](https://github.com/jaulz "jaulz (2 commits)")[![authanram](https://avatars.githubusercontent.com/u/1874088?v=4)](https://github.com/authanram "authanram (2 commits)")[![d8vjork](https://avatars.githubusercontent.com/u/2331052?v=4)](https://github.com/d8vjork "d8vjork (2 commits)")[![dmason30](https://avatars.githubusercontent.com/u/20278756?v=4)](https://github.com/dmason30 "dmason30 (2 commits)")[![0xflotus](https://avatars.githubusercontent.com/u/26602940?v=4)](https://github.com/0xflotus "0xflotus (2 commits)")[![morrislaptop](https://avatars.githubusercontent.com/u/67807?v=4)](https://github.com/morrislaptop "morrislaptop (2 commits)")[![hivokas](https://avatars.githubusercontent.com/u/22997803?v=4)](https://github.com/hivokas "hivokas (1 commits)")[![ILDaviz](https://avatars.githubusercontent.com/u/20944415?v=4)](https://github.com/ILDaviz "ILDaviz (1 commits)")[![istiak-tridip](https://avatars.githubusercontent.com/u/13367189?v=4)](https://github.com/istiak-tridip "istiak-tridip (1 commits)")[![it-can](https://avatars.githubusercontent.com/u/644288?v=4)](https://github.com/it-can "it-can (1 commits)")[![travisaustin](https://avatars.githubusercontent.com/u/1134334?v=4)](https://github.com/travisaustin "travisaustin (1 commits)")[![jenky](https://avatars.githubusercontent.com/u/1808758?v=4)](https://github.com/jenky "jenky (1 commits)")[![ksassnowski](https://avatars.githubusercontent.com/u/5139098?v=4)](https://github.com/ksassnowski "ksassnowski (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![leandrodiogenes](https://avatars.githubusercontent.com/u/2463299?v=4)](https://github.com/leandrodiogenes "leandrodiogenes (1 commits)")

---

Tags

laravelobjectjoblistenercommandcomponentcontrolleraction

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/lorisleiva-laravel-actions/health.svg)

```
[![Health](https://phpackages.com/badges/lorisleiva-laravel-actions/health.svg)](https://phpackages.com/packages/lorisleiva-laravel-actions)
```

###  Alternatives

[imtigger/laravel-job-status

Laravel Job Status

5272.1M3](/packages/imtigger-laravel-job-status)[mxl/laravel-job

Laravel job tools

661.3M](/packages/mxl-laravel-job)[mpbarlow/laravel-queue-debouncer

A wrapper job for debouncing other queue jobs.

63714.4k1](/packages/mpbarlow-laravel-queue-debouncer)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[pmatseykanets/artisan-beans

Easily manage your Beanstalkd job queues right from the Laravel artisan command

4482.1k](/packages/pmatseykanets-artisan-beans)[tochka-developers/queue-promises

Promises for Laravel queue jobs

1912.3k](/packages/tochka-developers-queue-promises)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
