{"id":16511157,"url":"https://github.com/danog/ipc","last_synced_at":"2025-10-28T03:31:59.858Z","repository":{"id":56962167,"uuid":"240584256","full_name":"danog/ipc","owner":"danog","description":"Async IPC component for AMPHP","archived":false,"fork":false,"pushed_at":"2023-07-04T14:29:10.000Z","size":72,"stargazers_count":7,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"v1","last_synced_at":"2025-02-01T11:11:07.209Z","etag":null,"topics":["amphp","ipc","multiprocessing","multithreading"],"latest_commit_sha":null,"homepage":null,"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/danog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2020-02-14T19:31:34.000Z","updated_at":"2024-11-24T22:13:58.000Z","dependencies_parsed_at":"2024-06-18T22:32:31.236Z","dependency_job_id":"dfa71f98-b290-40b5-97fe-faae49d61141","html_url":"https://github.com/danog/ipc","commit_stats":{"total_commits":44,"total_committers":1,"mean_commits":44.0,"dds":0.0,"last_synced_commit":"ab6a5af03950e61846b36e65301e2bc278581a39"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danog%2Fipc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danog%2Fipc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danog%2Fipc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danog%2Fipc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danog","download_url":"https://codeload.github.com/danog/ipc/tar.gz/refs/heads/v1","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238590596,"owners_count":19497350,"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","ipc","multiprocessing","multithreading"],"created_at":"2024-10-11T15:59:10.907Z","updated_at":"2025-10-28T03:31:59.434Z","avatar_url":"https://github.com/danog.png","language":"PHP","funding_links":[],"categories":["Multiprocessing"],"sub_categories":["Tunnel"],"readme":"# IPC\n\n[![Continuous Integration](https://github.com/danog/ipc/actions/workflows/ci.yml/badge.svg)](https://github.com/danog/ipc/actions/workflows/ci.yml)\n![License](https://img.shields.io/badge/license-MIT-blue.svg)\n\n`danog/ipc` provides an async IPC server.\n\n## Installation\n\n```bash\ncomposer require danog/ipc\n```\n\n## Example\n\nServer:\n\n```php\n\u003c?php declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Amp\\Ipc\\Sync\\ChannelledSocket;\n\nuse function Amp\\async;\nuse function Amp\\Ipc\\listen;\n\n$clientHandler = function (ChannelledSocket $socket) {\n    echo \"Accepted connection\".PHP_EOL;\n\n    while ($payload = $socket-\u003ereceive()) {\n        echo \"Received $payload\".PHP_EOL;\n        if ($payload === 'ping') {\n            $socket-\u003esend('pong');\n            $socket-\u003edisconnect();\n        }\n    }\n    echo \"Closed connection\".PHP_EOL.\"==========\".PHP_EOL;\n};\n\n$server = listen(sys_get_temp_dir().'/test');\nwhile ($socket = $server-\u003eaccept()) {\n    async($clientHandler, $socket);\n}\n```\n\nClient:\n\n```php\n\u003c?php declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Amp\\Ipc\\Sync\\ChannelledSocket;\n\nuse function Amp\\async;\nuse function Amp\\Ipc\\connect;\n\n$clientHandler = function (ChannelledSocket $socket) {\n    echo \"Created connection.\".PHP_EOL;\n\n    while ($payload = $socket-\u003ereceive()) {\n        echo \"Received $payload\".PHP_EOL;\n    }\n    echo \"Closed connection\".PHP_EOL;\n};\n\n$channel = connect(sys_get_temp_dir().'/test');\n\n$thread = async($clientHandler, $channel);\n\n$channel-\u003esend('ping');\n\n$thread-\u003eawait();\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanog%2Fipc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanog%2Fipc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanog%2Fipc/lists"}