{"id":24694471,"url":"https://github.com/roadrunner-php/services","last_synced_at":"2026-01-26T07:16:00.286Z","repository":{"id":56933747,"uuid":"478050633","full_name":"roadrunner-php/services","owner":"roadrunner-php","description":"🔌 RoadRunner Services SDK","archived":false,"fork":false,"pushed_at":"2025-06-23T08:24:09.000Z","size":50,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"2.x","last_synced_at":"2025-08-26T17:42:25.687Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://roadrunner.dev","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roadrunner-php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"roadrunner-server"}},"created_at":"2022-04-05T09:04:12.000Z","updated_at":"2025-06-23T08:23:36.000Z","dependencies_parsed_at":"2024-04-11T19:03:50.294Z","dependency_job_id":null,"html_url":"https://github.com/roadrunner-php/services","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/roadrunner-php/services","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roadrunner-php%2Fservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roadrunner-php%2Fservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roadrunner-php%2Fservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roadrunner-php%2Fservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roadrunner-php","download_url":"https://codeload.github.com/roadrunner-php/services/tar.gz/refs/heads/2.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roadrunner-php%2Fservices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000725,"owners_count":26082895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-26T23:59:50.211Z","updated_at":"2025-10-09T01:31:09.477Z","avatar_url":"https://github.com/roadrunner-php.png","language":"PHP","funding_links":["https://github.com/sponsors/roadrunner-server"],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://roadrunner.dev\" target=\"_blank\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/roadrunner-server/.github/assets/8040338/e6bde856-4ec6-4a52-bd5b-bfe78736c1ff\"\u003e\n    \u003cimg align=\"center\" src=\"https://github.com/roadrunner-server/.github/assets/8040338/040fb694-1dd3-4865-9d29-8e0748c2c8b8\"\u003e\n  \u003c/picture\u003e\n\u003c/a\u003e\n\n# Roadrunner services manager\n\n[![PHP Version Require](https://poser.pugx.org/spiral/roadrunner-services/require/php)](https://packagist.org/packages/spiral/roadrunner-services)\n[![Latest Stable Version](https://poser.pugx.org/spiral/roadrunner-services/v/stable)](https://packagist.org/packages/spiral/roadrunner-services)\n[![phpunit](https://github.com/spiral/roadrunner-services/actions/workflows/phpunit.yml/badge.svg)](https://github.com/spiral/roadrunner-services/actions)\n[![psalm](https://github.com/spiral/roadrunner-services/actions/workflows/psalm.yml/badge.svg)](https://github.com/spiral/roadrunner-services/actions)\n[![Total Downloads](https://poser.pugx.org/spiral/roadrunner-services/downloads)](https://packagist.org/packages/spiral/roadrunner-services)\n\nThis package will help you to manage [Roadrunner services](https://docs.roadrunner.dev/plugins/service)\n\n## Requirements\n\nMake sure that your server is configured with following PHP version and extensions:\n\n- PHP 8.1+\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require spiral/roadrunner-services\n```\n\n## Usage\n\nSuch a configuration would be quite feasible to run:\n\n```yaml\nrpc:\n  listen: tcp://127.0.0.1:6001\n\nservice: {}\n```\n\nThen you need to create an instance of `Spiral\\RoadRunner\\Services\\Manager`\n\n```php\nuse Spiral\\RoadRunner\\Services\\Manager;\nuse Spiral\\Goridge\\RPC\\RPC;\n\n$rpc = RPC::create('tcp://127.0.0.1:6001'));\n$manager = new Manager($rpc);\n```\n\n### Create a new service\n\n```php\nuse Spiral\\RoadRunner\\Services\\Exception\\ServiceException;\n\ntry {\n    $result = $manager-\u003ecreate(\n        name: 'listen-jobs', \n        command: 'php app.php queue:listen',\n        processNum: 3,\n        execTimeout: 0,\n        remainAfterExit: false,\n        env: ['APP_ENV' =\u003e 'production'],\n        restartSec: 30\n    );\n    \n    if (!$result) {\n        throw new ServiceException('Service creation failed.');\n    }\n} catch (ServiceException $e) {\n    // handle exception\n}\n```\n\n### Check service status\n\n```php\nuse Spiral\\RoadRunner\\Services\\Exception\\ServiceException;\n\ntry {\n    $status = $manager-\u003estatuses(name: 'listen-jobs');\n    \n    // Will return an array with statuses of every run process\n    // [\n    //    [\n    //      'cpu_percent' =\u003e 59.5,\n    //      'pid' =\u003e 33,\n    //      'memory_usage' =\u003e 200,\n    //      'command' =\u003e 'foo/bar',\n    //      'error' =\u003e null\n    //    ],\n    //    [\n    //      'cpu_percent' =\u003e 60.2,\n    //      'pid' =\u003e 34,\n    //      'memory_usage' =\u003e 189,\n    //      'command' =\u003e 'foo/bar'\n    //      'error' =\u003e [\n    //          'code' =\u003e 1,\n    //          'message' =\u003e 'Process exited with code 1'\n    //          'details' =\u003e [...] // array with details\n    //      ]\n    //    ],\n    // ] \n} catch (ServiceException $e) {\n    // handle exception\n}\n```\n\n### Restart service\n\n```php\nuse Spiral\\RoadRunner\\Services\\Exception\\ServiceException;\n\ntry {\n    $result = $manager-\u003erestart(name: 'listen-jobs');\n    \n    if (!$result) {\n        throw new ServiceException('Service restart failed.');\n    }\n} catch (ServiceException $e) {\n    // handle exception\n}\n```\n\n### Terminate service\n\n```php\nuse Spiral\\RoadRunner\\Services\\Exception\\ServiceException;\n\ntry {\n    $result = $manager-\u003eterminate(name: 'listen-jobs');\n    \n    if (!$result) {\n        throw new ServiceException('Service termination failed.');\n    }\n} catch (ServiceException $e) {\n    // handle exception\n}\n```\n\n### List of all services\n\n```php\nuse Spiral\\RoadRunner\\Services\\Exception\\ServiceException;\n\ntry {\n    $services = $manager-\u003elist();\n    \n    // Will return an array with services names\n    // ['listen-jobs', 'websocket-connection'] \n} catch (ServiceException $e) {\n    // handle exception\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froadrunner-php%2Fservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froadrunner-php%2Fservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froadrunner-php%2Fservices/lists"}