roadrunner / worker
Base PHP worker for the RoadRunner application server: receives payloads over Goridge, sends responses and manages the worker pool
Fund package maintenance!
Requires
- php: >=8.2
- composer-runtime-api: ^2.0
- ext-json: *
- ext-sockets: *
- psr/log: ^2.0 || ^3.0
- roadrunner/goridge: ^4.5
- spiral/roadrunner: ^3.0
Requires (Dev)
- buggregator/trap: ^1.13
- jetbrains/phpstorm-attributes: ^1.0
- mockery/mockery: ^1.6.7
- spiral/code-style: ^2.3.1
- testo/bridge-mockery: ^0.1.2
- testo/testo: ^0.10.55
- vimeo/psalm: ^6 || ^7
Suggests
- roadrunner/cli: Provides RoadRunner installation and management CLI tools
Provides
None
Conflicts
None
Replaces
- spiral/roadrunner-worker: v3.8.0
- 3.x-dev
- v3.8.0
- v3.7.0
- v3.6.2
- v3.6.1
- v3.6.0
- v3.5.0
- v3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.x-dev
- v2.3.0
- v2.2.0
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- 1.x-dev
- dev-release-please--branches--3.x--components--roadrunner/worker
- dev-release-please--branches--3.x--components--spiral/roadrunner-worker
- dev-feature/payload-encoding
- dev-feature/forking
This package is auto-updated.
Last update: 2026-10-10 12:54:15 UTC
README
The common PHP worker for the RoadRunner application server
This package contains the common codebase for all RoadRunner PHP workers: it receives payloads from the server over Goridge, sends responses back and gives access to the worker environment and the worker pool. Check roadrunner-server/roadrunner for the application server itself and roadrunner-php/http for a PSR-7 compatible HTTP worker.
Get Started
Installation
composer require roadrunner/worker
The RoadRunner binary can be downloaded with the RoadRunner CLI:
composer require roadrunner/cli --dev vendor/bin/rr get
Configuration
Point the RoadRunner server to your worker script in .rr.yaml:
version: '3' server: command: "php worker.php"
See the documentation for the full list of options.
Writing a Worker
A minimal worker that receives payloads and responds to them:
<?php require __DIR__ . '/vendor/autoload.php'; use Spiral\RoadRunner\Payload; use Spiral\RoadRunner\Worker; // Create a new Worker from the global environment $worker = Worker::create(); while ($payload = $worker->waitPayload()) { // Received payload var_dump($payload->body); // Respond $worker->respond(new Payload('DONE')); }
Testing
composer test