{"id":16316791,"url":"https://github.com/makasim/php-fpm-queue","last_synced_at":"2025-07-21T16:06:31.499Z","repository":{"id":52250770,"uuid":"153127358","full_name":"makasim/php-fpm-queue","owner":"makasim","description":"Use php-fpm as a simple built-in async queue","archived":false,"fork":false,"pushed_at":"2021-05-03T13:38:42.000Z","size":9,"stargazers_count":115,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T22:14:29.471Z","etag":null,"topics":["cgi","fastcgi","message-queue","php","php-fpm","queue"],"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/makasim.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}},"created_at":"2018-10-15T14:24:44.000Z","updated_at":"2025-03-20T13:06:52.000Z","dependencies_parsed_at":"2022-08-22T09:31:50.312Z","dependency_job_id":null,"html_url":"https://github.com/makasim/php-fpm-queue","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/makasim/php-fpm-queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makasim%2Fphp-fpm-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makasim%2Fphp-fpm-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makasim%2Fphp-fpm-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makasim%2Fphp-fpm-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makasim","download_url":"https://codeload.github.com/makasim/php-fpm-queue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makasim%2Fphp-fpm-queue/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266332520,"owners_count":23912662,"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-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["cgi","fastcgi","message-queue","php","php-fpm","queue"],"created_at":"2024-10-10T22:05:38.629Z","updated_at":"2025-07-21T16:06:31.471Z","avatar_url":"https://github.com/makasim.png","language":"PHP","readme":"# PHP-FPM Async Queue\n\nUse php-fpm as a simple built-in async queue. Based on interoperable queue interfaces [Queue Interop](https://github.com/queue-interop/queue-interop).  \n\n## Usage\n\n```bash\ncomposer makasim/php-fpm-queue:0.1.x-dev queue-interop/queue-interop:0.7.x-dev enqueue/dsn:0.9.x-dev\n```\n\nA sender script:\n\n```php\n\u003c?php\n# sender.php\n\nuse Makasim\\PhpFpm\\PhpFpmConnectionFactory;\n\nrequire_once __DIR__.'/vendor/autoload.php';\n\n$context = (new PhpFpmConnectionFactory('tcp://localhost:9000'))-\u003ecreateContext();\n\n$queue = $context-\u003ecreateQueue('/app/worker.php');\n$message = $context-\u003ecreateMessage('aBody');\n\n$context-\u003ecreateProducer()-\u003esend($queue, $message);\n```\n\nA worker script:\n\n\n```php\n\u003c?php\n# worker.php\n\nuse Makasim\\PhpFpm\\PhpFpmConnectionFactory;\n\nrequire_once __DIR__.'/vendor/autoload.php';\n\n$context = (new PhpFpmConnectionFactory('tcp://localhost:9000'))-\u003ecreateContext();\n// or\n//$context = (new PhpFpmConnectionFactory('unix:///var/run/php/php7.1-fpm.sock'))-\u003ecreateContext(); \n\n$queue = $context-\u003ecreateQueue(__FILE__);\n\n$consumer = $context-\u003ecreateConsumer($queue);\n\nif ($message = $consumer-\u003ereceiveNoWait()) {\n    // process message\n\n    $consumer-\u003eacknowledge($message);\n}\n```\n\nStart PHP-FPM:\n\n```bash\ndocker run -v `pwd`:/app -p 9000:9000 php:7.2-fpm\n```\n\nSend a message:\n\n```bash\nphp sender.php\n```\n\n## Credits\n\nInspired by Benjamin post [Using php-fpm as a simple built-in async queue](https://tideways.com/profiler/blog/using-php-fpm-as-a-simple-built-in-async-queue)\n\n## License\n\n[MIT License](LICENSE)            ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakasim%2Fphp-fpm-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakasim%2Fphp-fpm-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakasim%2Fphp-fpm-queue/lists"}