{"id":13616405,"url":"https://github.com/amphp/process","last_synced_at":"2025-05-14T07:08:32.663Z","repository":{"id":30836213,"uuid":"34393645","full_name":"amphp/process","owner":"amphp","description":"An async process dispatcher for Amp.","archived":false,"fork":false,"pushed_at":"2024-12-13T17:40:58.000Z","size":675,"stargazers_count":239,"open_issues_count":5,"forks_count":30,"subscribers_count":10,"default_branch":"2.x","last_synced_at":"2025-04-12T22:16:57.487Z","etag":null,"topics":["amphp","async","multiprocessing","php","processes"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"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/amphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"amphp"}},"created_at":"2015-04-22T14:00:47.000Z","updated_at":"2025-03-05T20:18:14.000Z","dependencies_parsed_at":"2024-02-17T05:23:44.156Z","dependency_job_id":"20b2a5dc-7ec0-43c9-995b-c754cefe7704","html_url":"https://github.com/amphp/process","commit_stats":{"total_commits":236,"total_committers":15,"mean_commits":"15.733333333333333","dds":0.5127118644067796,"last_synced_commit":"a65d3bc1f36ef12d44df42a68f0f0643183f1052"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amphp%2Fprocess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amphp%2Fprocess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amphp%2Fprocess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amphp%2Fprocess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amphp","download_url":"https://codeload.github.com/amphp/process/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092775,"owners_count":22013290,"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","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":["amphp","async","multiprocessing","php","processes"],"created_at":"2024-08-01T20:01:28.112Z","updated_at":"2025-05-14T07:08:32.638Z","avatar_url":"https://github.com/amphp.png","language":"PHP","readme":"# amphp/process\n\nAMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind.\n`amphp/process` provides an asynchronous process dispatcher that works on all major platforms (including Windows).\nIt makes running child processes simple.\n\nAs Windows pipes are file handles and do not allow non-blocking access, this package makes use of a [process wrapper](https://github.com/amphp/windows-process-wrapper), that provides access to these pipes via sockets.\nOn Unix-like systems it uses the standard pipes, as these can be accessed without blocking there.\nConcurrency is managed by the [Revolt](https://revolt.run/) event loop.\n\n[![Latest Release](https://img.shields.io/github/release/amphp/process.svg?style=flat-square)](https://github.com/amphp/process/releases)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/amphp/process/blob/master/LICENSE)\n\n## Installation\n\nThis package can be installed as a [Composer](https://getcomposer.org/) dependency.\n\n```\ncomposer require amphp/process\n```\n\nThe package requires PHP 8.1 or later.\n\n## Usage\n\nProcesses are started with `Process::start()`:\n\n```php\n\u003c?php\n\nrequire __DIR__ . \"/vendor/autoload.php\";\n\nuse Amp\\ByteStream;\nuse Amp\\Process\\Process;\n\n// \"echo\" is a shell internal command on Windows and doesn't work.\n$command = DIRECTORY_SEPARATOR === \"\\\\\" ? \"cmd /c echo Hello World!\" : \"echo 'Hello, world!'\";\n\n$process = Process::start($command);\n\nAmp\\async(fn () =\u003e Amp\\ByteStream\\pipe($process-\u003egetStdout(), ByteStream\\getStdout()));\nAmp\\async(fn () =\u003e Amp\\ByteStream\\pipe($process-\u003egetStderr(), ByteStream\\getStderr()));\n\n$exitCode = $process-\u003ejoin();\n\necho \"Process exited with {$exitCode}.\\n\";\n```\n\n### Custom Working Directory\n\nProcesses are started with the working directory of the current process by default.\nThe working directory can be customized to another directory if needed:\n\n```php\n$process = Amp\\Process\\Process::start($command, workingDirectory: '/path/of/your/dreams');\n```\n\n### Custom Environment Variables\n\nProcesses are started with the environment variables of the current process by default.\nThe environment can be customized by passing an associative array mapping variables names to their values:\n\n```php\n$process = Amp\\Process\\Process::start($command, environment: [\n    'PATH' =\u003e '/usr/bin/local'\n]);\n```\n\n## Versioning\n\n`amphp/process` follows the [semver](http://semver.org/) semantic versioning specification like all other `amphp` packages.\n\n## Security\n\nIf you discover any security related issues, please use the private security issue reporter instead of using the public issue tracker.\n\n## License\n\nThe MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information.\n","funding_links":["https://github.com/sponsors/amphp"],"categories":["Multiprocessing","PHP"],"sub_categories":["Tunnel"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famphp%2Fprocess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famphp%2Fprocess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famphp%2Fprocess/lists"}