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.3.1(1mo ago)03.7k↑1646.7%[1 PRs](https://github.com/havnnl/laravel-executable/pulls)MITPHPPHP ^8.3CI passing

Since Feb 23Pushed 1w 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 2d ago

READMEChangelog (7)Dependencies (37)Versions (11)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

48

—

FairBetter than 93% of packages

Maintenance95

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.8% 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 ~15 days

Recently: every ~22 days

Total

7

Last Release

38d 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 (30 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

actionslaravelphpqueuetestinglaravelexecutablequeuejobsactionssingle-responsibility

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### 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.2k95.4M306](/packages/laravel-horizon)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M8.4k](/packages/larastan-larastan)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k55.0M619](/packages/laravel-scout)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)

PHPackages © 2026

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