PHPackages                             symplely/processor - 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. symplely/processor

Abandoned → [symplely/spawn](/?search=symplely%2Fspawn)Library[Queues &amp; Workers](/categories/queues)

symplely/processor
==================

An Symfony Process Manager offering Parallel and asynchronous PHP for Blocking I/O.

1.4.3(6y ago)21.7k↓100%MITPHPPHP &gt;7.2CI failing

Since May 25Pushed 6y agoCompare

[ Source](https://github.com/symplely/processor)[ Packagist](https://packagist.org/packages/symplely/processor)[ Docs](https://github.com/symplely/processor)[ RSS](/packages/symplely-processor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (16)Used By (0)

Processor
=========

[](#processor)

[![Build Status](https://camo.githubusercontent.com/b3512066deaa495085b0e04791556f9e3465d9ef679830f01427c5eca1521a38/68747470733a2f2f7472617669732d63692e6f72672f73796d706c656c792f70726f636573736f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/symplely/processor)[![Build status](https://camo.githubusercontent.com/d624c607a51fbebbfe1cef5c79d1cd89e930088fc05a894ee334a79884254fe6/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6e616f32636a646c78316e396b6132382f6272616e63682f6d61737465723f7376673d74727565)](https://ci.appveyor.com/project/techno-express/processor-hrjtw/branch/master)[![codecov](https://camo.githubusercontent.com/dd06054a663c3c73dc890c8c3a095737110c94dfc869e9fbfcc1d69f54ce3522/68747470733a2f2f636f6465636f762e696f2f67682f73796d706c656c792f70726f636573736f722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/symplely/processor)[![Codacy Badge](https://camo.githubusercontent.com/9a272dfe4b231ed6826b30c28a8a05fa64669e9c6a7ee79c92a6a5d7c4f5edc2/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3737663030626536386536363432333961376461646664343839326337393662)](https://www.codacy.com/app/techno-express/processor?utm_source=github.com&utm_medium=referral&utm_content=symplely/processor&utm_campaign=Badge_Grade)[![Maintainability](https://camo.githubusercontent.com/7bbf5cfdd625b5b16c7bde52cd0393ef9dc0a953397deee62b70d80c693e120c/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f61333662663731383163626566623661303033382f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/symplely/processor/maintainability)

An simply **process manager** wrapper API for [symfony/process](https://github.com/symfony/process) to *execute* and *manage* **sub-processes**.

It's an alternative to pcntl-extension, when not installed. This is part of our [symplely/coroutine](https://github.com/symplely/coroutine) package for handling any **blocking i/o** process not handle by [**Coroutine**](https://github.com/symplely/coroutine) natively.

The library is to provide an easy to use API to control/manage sub processes for windows OS, and other systems, without any additional software extensions installed.

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

[](#installation)

```
composer require symplely/processor
```

Usage
-----

[](#usage)

```
include 'vendor/autoload.php';

use Async\Processor\Processor;

// To set the path to PHP executable for child process
Processor::phpPath('/some/path/version-7.3/bin/php');

$process = \spawn($function, $timeout, $channel)
// Or
$process = Processor::create(function () use ($thing) {
    // Do a thing
    }, $timeout, $channel)
    ->then(function ($output) {
        // Handle success
    })->catch(function (\Throwable $exception) {
        // Handle exception
});

\spawn_run($process);
// Or
$process->run();

// Second option can be used to set to display child output, default is false
\spawn_run($process, true);
// Or
$process->displayOn()->run();
```

Channel - Transfer messages between a Process
---------------------------------------------

[](#channel---transfer-messages-between-a-process)

```
include 'vendor/autoload.php';

use Async\Processor\Channel;
use Async\Processor\ChannelInterface;

$ipc = new Channel();

$process = spawn(function (ChannelInterface $channel) {
    $channel->write('ping'); // same as echo 'ping' or echo fwrite(STDOUT, 'ping')
    usleep(1000);
    echo $channel->read(); // same as echo fgets(STDIN);
    echo $channel->read();
    usleep(1000);
    return 'return whatever';
    }, 300, $ipc)
        ->progress(function ($type, $data) use ($ipc) {
            if ('ping' === $data) {
                $ipc->send('pang' . \PHP_EOL);
            } elseif (!$ipc->isClosed()) {
                $ipc->send('pong' . \PHP_EOL);
                    ->close();
            }
        });

$ipc->setup($process)
\spawn_run($process);

echo \spawn_output($process); // pingpangpongreturn whatever
// Or
echo $ipc->receive(); // return whatever
```

Event hooks
-----------

[](#event-hooks)

When creating asynchronous processes, you'll get an instance of `LauncherInterface` returned. You can add the following event hooks on a process.

```
$process = spawn($function, $timeout, $channel)
// Or
$process = Processor::create(function () {
        // The second argument is optional, Defaults 300.
        // it sets The maximum amount of time a process may take to finish in seconds
        // The third is optional input pipe to pass to subprocess
    }, int $timeout = 300 , $input = null)
    ->then(function ($output) {
        // On success, `$output` is returned by the process.
    })
    ->catch(function ($exception) {
        // When an exception is thrown from within a process, it's caught and passed here.
    })
    ->timeout(function () {
        // When an time is reached, it's caught and passed here.
    })
    ->progress(function ($type, $data) {
        // A IPC like gateway: `$type, $data` is returned by the process progressing, it's producing output.
        // This can be use as a IPC handler for real time interaction.
    });
```

There also `->done`, part of `->then()` extended callback method.

```
->done(function ($result) {
    // On success, `$result` is returned by the process or callable you passed to the queue.
});
->then(function ($resultOutput) {
        //
    }, function ($catchException) {
        //
    }, function ($progressOutput) {
        //
    }
);

// To turn on to display child output.
->displayOn();

// Stop displaying child output.
->displayOff();

// To display child output, only by third party means once turned on.
->display();

// Processes can be retried.
->restart();
->run();
```

Error handling
--------------

[](#error-handling)

If an `Exception` or `Error` is thrown from within a child process, it can be caught per process by specifying a callback in the `->catch()` method.

If there's no error handler added, the error will be thrown in the parent process when calling `spawn_run()` or `$process->run()`.

If the child process would unexpectedly stop without throwing an `Throwable`, the output written to `stderr` will be wrapped and thrown as `Async\Processor\ProcessorError` in the parent process.

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

[](#contributing)

Contributions are encouraged and welcome; I am always happy to get feedback or pull requests on Github :) Create [Github Issues](https://github.com/symplely/processor/issues) for bugs and new features and comment on the ones you are interested in.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~20 days

Recently: every ~1 days

Total

15

Last Release

2258d ago

PHP version history (2 changes)1.0.8PHP &gt;7.1

1.2.0PHP &gt;7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1a9d88c23f07f785e0358746ae2384950a6f8dac0c3bd4fbbc910e94f7eb637?d=identicon)[techno-express](/maintainers/techno-express)

---

Top Contributors

[![TheTechsTech](https://avatars.githubusercontent.com/u/29784725?v=4)](https://github.com/TheTechsTech "TheTechsTech (70 commits)")

---

Tags

multiprocessingprocessprocess-managerprocessorsubprocesssymfonyasyncprocesscommandtaskprocessorsub process

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/symplely-processor/health.svg)

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

###  Alternatives

[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

53541.0k3](/packages/jolicode-castor)[qruto/laravel-flora

Install and update Laravel application with single command

13197.8k](/packages/qruto-laravel-flora)[orisai/scheduler

Cron job scheduler - with locks, parallelism and more

4037.1k4](/packages/orisai-scheduler)[symplely/coroutine

Cooperative multitasking using generators. The basics of coroutines, async and await!

631.6k2](/packages/symplely-coroutine)[g4/tasker

Application asynchronous tasks manager and runner, cron-like PHP implementation with ability to run tasks with resolution in seconds

1455.1k](/packages/g4-tasker)

PHPackages © 2026

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