PHPackages                             switon/executor - 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. [Framework](/categories/framework)
4. /
5. switon/executor

ActiveLibrary[Framework](/categories/framework)

switon/executor
===============

Runner execution with batch, any-first, and task-scoped concurrency APIs for Switon Framework

v1.0.0(1mo ago)0133MITPHPPHP &gt;=8.3CI passing

Since Jun 7Pushed 1mo agoCompare

[ Source](https://github.com/switon-php/executor)[ Packagist](https://packagist.org/packages/switon/executor)[ Docs](https://github.com/switon-php/executor)[ RSS](/packages/switon-executor/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (5)Versions (2)Used By (3)

Switon Executor Package
=======================

[](#switon-executor-package)

[![Executor CI](https://camo.githubusercontent.com/8b95cdd43792d88497044129b8dbc8e48de4d501a9a2913ee4e25cabab8189a9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f737769746f6e2d7068702f6578656375746f722f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4578656375746f722532304349)](https://github.com/switon-php/executor/actions/workflows/ci.yml) [![PHP 8.3+](https://camo.githubusercontent.com/c03f51341eebaefabbf137e291b20523fc74b4ffd084406d88524d266d95085d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d373737424234)](https://www.php.net/)

Switon's execution layer for container-registered runners, ordered batch results, first-success selection, and runner lifecycle events.

Highlights
----------

[](#highlights)

- **Task routing:** task ids resolve to the right runner service.
- **Batch execution:** `invokeAll()` keeps results in input order.
- **First-success mode:** `invokeAny()` returns the first successful result.
- **Lifecycle visibility:** `RunnerStarting` and `RunnerFinished` expose run data.
- **Async coordination:** `Future` and `Gate` support ordered task handling.

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

[](#installation)

```
composer require switon/executor
```

Quick Start
-----------

[](#quick-start)

```
use Switon\Core\Attribute\Autowired;
use Switon\Core\RunnerInterface;
use Switon\Executor\ExecutorInterface;
use Switon\Executor\FutureInterface;

final class ReportRunner implements RunnerInterface
{
    public function run(mixed $payload): array
    {
        return ['id' => $payload['id']];
    }
}

final class ReportService
{
    #[Autowired] protected ExecutorInterface $executor;

    public function export(): array
    {
        $futures = $this->executor->invokeAll([
            ['report:daily', ['id' => 1]],
            ['report:weekly', ['id' => 2]],
        ]);

        return array_map(static fn (FutureInterface $future) => $future->result(), $futures);
    }

    public function fallback(): mixed
    {
        return $this->executor->invokeAny([
            ['report:primary', ['id' => 1]],
            ['report:backup', ['id' => 1]],
        ]);
    }
}
```

Docs:

License
-------

[](#license)

MIT.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance90

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc0f20ad15b0ae9fbf9c6e2cd3008692b0c88a877ec8d3e0119211314bf86fc8?d=identicon)[switon](/maintainers/switon)

---

Top Contributors

[![switon-php](https://avatars.githubusercontent.com/u/247358032?v=4)](https://github.com/switon-php "switon-php (3 commits)")

---

Tags

executorruntimeswitontasksruntimeexecutorTasksswiton

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/switon-executor/health.svg)

```
[![Health](https://phpackages.com/badges/switon-executor/health.svg)](https://phpackages.com/packages/switon-executor)
```

###  Alternatives

[utopia-php/queue

A powerful task queue.

11243.0k6](/packages/utopia-php-queue)[extism/extism

Make your software programmable. Run WebAssembly extensions in your app using the first off-the-shelf, universal plug-in system.

326.3k1](/packages/extism-extism)[yii2-extensions/franken-php

Supercharge your Yii2 applications with FrankenPHP blazing-fast HTTP server.

243.0k](/packages/yii2-extensions-franken-php)

PHPackages © 2026

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