PHPackages                             havn/laravel-executable - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. havn/laravel-executable

ActiveLibrary[Testing &amp; Quality](/categories/testing)

havn/laravel-executable
=======================

Single-task action classes for Laravel. Fully queueable, with a testing API that makes you like writing tests more than the actual code.

v1.2.1(2mo ago)01.3k↑166.7%[1 PRs](https://github.com/havnnl/laravel-executable/pulls)MITPHPPHP ^8.3CI passing

Since Feb 23Pushed 2mo agoCompare

[ Source](https://github.com/havnnl/laravel-executable)[ Packagist](https://packagist.org/packages/havn/laravel-executable)[ Docs](https://github.com/havnnl/laravel-executable)[ RSS](/packages/havn-laravel-executable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (21)Versions (7)Used By (0)

Single-task action classes for Laravel.
=======================================

[](#single-task-action-classes-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8b81c0da0077b56adf5319f4f8f5227cb0004378b9c1668b2499452a6e471127/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6861766e2f6c61726176656c2d65786563757461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/havn/laravel-executable)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0b2bbccbc1516533682566137425684e74b49f832940e16c7dfcbbb44e60da58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6861766e6e6c2f6c61726176656c2d65786563757461626c652f7068702d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/havnnl/laravel-executable/actions?query=workflow%3Aphp-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/cf34547347f9b6557f1013e62842e14904c37c20c549f4c71f1f390697ef09a3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6861766e6e6c2f6c61726176656c2d65786563757461626c652f7068702d636f64652d7374796c652d66697865722e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/havnnl/laravel-executable/actions?query=workflow%3Aphp-code-style-fixer+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/e7ce85d8d9f07d83ed37584de7e6f2c8e7bb473ec70dda0b0ccd490749eefd21/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6861766e2f6c61726176656c2d65786563757461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/havn/laravel-executable)

Fully queueable, with a testing API that makes you like writing tests more than the actual code.

Read the full documentation at [docs.havn.nl](https://docs.havn.nl/laravel-executable/).

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

[](#installation)

```
composer require havn/laravel-executable
```

**Requirements:** PHP 8.3+ | Laravel 12+

Quick Example
-------------

[](#quick-example)

A plain PHP class with a trait and an `execute()` method:

```
use Havn\Executable\QueueableExecutable;

class ProcessPayment
{
    use QueueableExecutable;

    public function __construct(
        private PaymentGateway $gateway,
    ) {}

    public function execute(Payment $payment): void
    {
        $this->gateway->charge($payment);

        $payment->update(['status' => 'completed']);
    }
}
```

Four execution modes:

```
// Sync — runs immediately, returns the result
ProcessPayment::sync()->execute($payment);

// Queue — dispatches to the queue
ProcessPayment::onQueue()->execute($payment);

// Prepare — returns a job without dispatching (for chains and batches)
$job = ProcessPayment::prepare()->execute($payment);

// Test — runs the real code in a testable context
ProcessPayment::test()->execute($payment);
```

Queue configuration at dispatch time:

```
ProcessPayment::onQueue('high-priority')
    ->delay(60)
    ->tries(3)
    ->execute($payment);
```

Testing
-------

[](#testing)

Mock, spy, or assert. All built in:

```
// Mock
ProcessPayment::mock()
    ->shouldExecute()
    ->with($payment)
    ->once();

// Spy
ProcessPayment::spy();
ProcessPayment::sync()->execute($payment);
ProcessPayment::assert()->executed()->with($payment);

// Queue assertions
Queue::fake();
ProcessPayment::onQueue()->execute($payment);
ProcessPayment::assert()->queued()->on('high-priority')->with($payment)->once();
```

Contributing
------------

[](#contributing)

Contributions are welcome. Please see [CONTRIBUTING](https://github.com/havnnl/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

Please review [our security policy](../../security/policy) for reporting security vulnerabilities.

License
-------

[](#license)

The MIT License (MIT). See [License File](LICENSE.md) for details.

Credits
-------

[](#credits)

- [Henk Koop](https://github.com/hxnk)
- [All Contributors](../../contributors)

---

Made with care by [Havn](https://havn.nl)

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance87

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~2 days

Total

5

Last Release

73d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1008127?v=4)[Henk Koop](/maintainers/hxnk)[@hxnk](https://github.com/hxnk)

---

Top Contributors

[![hxnk](https://avatars.githubusercontent.com/u/1008127?v=4)](https://github.com/hxnk "hxnk (22 commits)")

---

Tags

actionslaravelphpqueuetestinglaravelexecutablequeuejobsactionssingle-responsibility

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/havn-laravel-executable/health.svg)

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k84.2M225](/packages/laravel-horizon)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[croustibat/filament-jobs-monitor

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

254255.2k6](/packages/croustibat-filament-jobs-monitor)[sti3bas/laravel-scout-array-driver

Array driver for Laravel Scout

971.5M3](/packages/sti3bas-laravel-scout-array-driver)[harris21/laravel-fuse

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

3786.5k](/packages/harris21-laravel-fuse)[yangusik/laravel-balanced-queue

Laravel queue management with load balancing between partitions (user groups)

786.4k](/packages/yangusik-laravel-balanced-queue)

PHPackages © 2026

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