spiral / roadrunner-services
Manage RoadRunner services from PHP: create, start, stop and inspect processes supervised by the RoadRunner service plugin
Fund package maintenance!
2.4.0
2026-10-10 13:13 UTC
Requires
- php: >=8.2
- google/protobuf: ^3.7 || ^4.0 || ^5.0
- roadrunner/api-dto: ^2.1
- roadrunner/goridge: ^4.5
- spiral/roadrunner: ^3.0
Requires (Dev)
- mockery/mockery: ^1.5
- spiral/code-style: ^2.3.1
- testo/bridge-mockery: ^0.1.2
- testo/testo: ^0.10.55
- vimeo/psalm: ^6 || ^7
Suggests
None
Provides
None
Conflicts
None
Replaces
- spiral/roadrunner-services: 2.4.0
- 2.x-dev
- 2.4.0
- 2.3.0
- 2.2.1
- v2.2.0
- v2.1.1
- 2.1.0
- 2.0.0
- 1.x-dev
- 1.1.0
- 1.0.1
- 1.0.0
- dev-release-please--branches--2.x--components--roadrunner/services
- dev-release-please--branches--2.x--components--spiral/roadrunner-services
- dev-rr-v3
- dev-static-analysis
- dev-ci/mutation-testing
- dev-coverage
- dev-testo
- dev-ci/code-style
- dev-chore/codeowners
- dev-docs/readme
- dev-ci/security-audit
- dev-ci/release-please
- dev-complex-update-2.x
This package is auto-updated.
Last update: 2026-10-10 13:14:08 UTC
README
Manage RoadRunner services from PHP
This package lets a PHP application create, restart, terminate and inspect RoadRunner services at runtime over RPC.
Get Started
Installation
composer require roadrunner/services
Configuration
Enable the RPC and service plugins in .rr.yaml:
rpc: listen: tcp://127.0.0.1:6001 service: {}
Connecting to RoadRunner
Create an instance of Spiral\RoadRunner\Services\Manager:
use Spiral\RoadRunner\Services\Manager; use Spiral\Goridge\RPC\RPC; $rpc = RPC::create('tcp://127.0.0.1:6001'); $manager = new Manager($rpc);
Managing Services
Create a new service
use Spiral\RoadRunner\Services\Exception\ServiceException; try { $result = $manager->create( name: 'listen-jobs', command: 'php app.php queue:listen', processNum: 3, execTimeout: 0, remainAfterExit: false, env: ['APP_ENV' => 'production'], restartSec: 30, serviceNameInLogs: true, stopTimeout: 5, ); if (!$result) { throw new ServiceException('Service creation failed.'); } } catch (ServiceException $e) { // handle exception }
Check service status
use Spiral\RoadRunner\Services\Exception\ServiceException; try { $status = $manager->statuses(name: 'listen-jobs'); // Will return an array with statuses of every run process // [ // [ // 'cpu_percent' => 59.5, // 'pid' => 33, // 'memory_usage' => 200, // 'command' => 'foo/bar', // 'error' => null, // ], // [ // 'cpu_percent' => 60.2, // 'pid' => 34, // 'memory_usage' => 189, // 'command' => 'foo/bar', // 'error' => [ // 'code' => 1, // 'message' => 'Process exited with code 1', // 'details' => [...] // array with details // ] // ], // ] } catch (ServiceException $e) { // handle exception }
Restart service
use Spiral\RoadRunner\Services\Exception\ServiceException; try { $result = $manager->restart(name: 'listen-jobs'); if (!$result) { throw new ServiceException('Service restart failed.'); } } catch (ServiceException $e) { // handle exception }
Terminate service
use Spiral\RoadRunner\Services\Exception\ServiceException; try { $result = $manager->terminate(name: 'listen-jobs'); if (!$result) { throw new ServiceException('Service termination failed.'); } } catch (ServiceException $e) { // handle exception }
List of all services
use Spiral\RoadRunner\Services\Exception\ServiceException; try { $services = $manager->list(); // Will return an array with services names // ['listen-jobs', 'websocket-connection'] } catch (ServiceException $e) { // handle exception }