PHPackages                             flytachi/winter-thread - 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. flytachi/winter-thread

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

flytachi/winter-thread
======================

A lightweight process engine for PHP — Java-like control of background tasks as isolated OS processes, without heavy extensions (no swoole/pthreads/parallel).

v3.1.0(3w ago)1575↓63.5%1MITPHPPHP &gt;=8.4CI passing

Since Dec 18Pushed 3w agoCompare

[ Source](https://github.com/Flytachi/winter-thread)[ Packagist](https://packagist.org/packages/flytachi/winter-thread)[ Docs](https://winterframe.net)[ RSS](/packages/flytachi-winter-thread/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (12)Versions (18)Used By (1)

Winter Thread: A Modern Process Control Library for PHP
=======================================================

[](#winter-thread-a-modern-process-control-library-for-php)

[![Tests](https://camo.githubusercontent.com/b4a9b3aef129aa654cc57a326180c2be3cced58dd430610960b34f3b1a132b2d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f666c7974616368692f77696e7465722d7468726561642f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473)](https://github.com/flytachi/winter-thread/actions/workflows/ci.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/52f623912eb6fb984078619d594d7073a678b46473e2824d18a2207c3acb60a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c7974616368692f77696e7465722d7468726561642e737667)](https://packagist.org/packages/flytachi/winter-thread)[![PHP Version Require](https://camo.githubusercontent.com/c0a3d91a7f0418b5596220865a9810548d5cae251bd6ff5fdf041413a58428d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f666c7974616368692f77696e7465722d7468726561642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/flytachi/winter-thread)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)

**Winter Thread** is a *process engine* for PHP: a clean, object-oriented, Java-like API for running and controlling background tasks as isolated OS processes — for parallel and long-running work.

> **It's an engine — the foundation you build on.** A small, dependable core, not a batteries-included framework: the layer your **queues, pools, schedulers and workers** sit *on top of*. You bring the higher-level concurrency; the engine handles the hard, boring parts — spawning, signals, isolation, transports.
>
> **A `Thread` here is a *process*, not a PHP thread.** The name is a deliberate nod to a familiar API — just as Python's `multiprocessing.Process` mirrors its threading interface. Every `Thread` is one fully isolated OS process wearing a clean, thread-like face (`start()`, `join()`, `isAlive()`) — so there's no shared state to corrupt and nothing to leak between tasks.

**No heavy extensions.** Unlike `pthreads`, `ext-parallel`, or Swoole, it needs no ZTS build and no exotic runtime — just `proc_open` and the standard POSIX extensions (`ext-pcntl`, `ext-posix`) that ship with nearly every PHP install. Each task runs in a fresh, isolated PHP process, so there is no shared state to corrupt and no inherited connections to break.

Key Features
------------

[](#key-features)

- **No heavy extensions**: No swoole / parallel / pthreads, no ZTS build — just `proc_open` + standard POSIX. Runs on a normal PHP install.
- **Clean process isolation**: Each task runs in a brand-new PHP process — no inherited DB connections, sockets, or global state to corrupt.
- **Fluent, Object-Oriented API**: Manage background processes as objects.
- **Full Process Control**: `start()`, `join()`, `pause()`, `resume()`, `terminate()`, and `kill()`.
- **Advanced Process Naming**: Identify your processes easily with namespaces, names, and tags.
- **Safe by Default**: Output goes to `/dev/null` by default — no Broken pipe risk for fire-and-forget jobs.
- **Swoole / Event-Loop Compatible**: Launch background tasks from inside a coroutine safely — the default `AdaptiveLauncher` routes to a Swoole-native backend (`Coroutine\System::exec`) where `proc_open` would corrupt the reactor's fds, with pipe-free payload transports (temp-file, shared-memory). No `ext-swoole` required; it's used only when present.
- **Zombie-free fire-and-forget**: Optional detached mode (`fork` + `setsid`) reparents workers to init, so long-lived parents (FPM, daemons) never accumulate zombies.
- **Pluggable backend**: Swap the payload transport or the whole spawn strategy through a single `Launcher` — build custom backends (Docker, SSH, …) without touching `Thread`.
- **Java-like API**: Familiar method names like `isAlive()` and `join()` for an easy learning curve.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.4
- `ext-pcntl`
- `ext-posix`
- `opis/closure` ^4.5 (required; enables safe serialization of anonymous classes and closures)
- `ext-shmop` (optional; only for the shared-memory transport)

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

[](#installation)

```
composer require flytachi/winter-thread
```

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

[](#quick-start)

```
