{"id":16288653,"url":"https://github.com/smuuf/celery-for-php","last_synced_at":"2025-03-20T03:30:42.181Z","repository":{"id":192287367,"uuid":"686154079","full_name":"smuuf/celery-for-php","owner":"smuuf","description":"A modern PHP client library for Celery.","archived":false,"fork":false,"pushed_at":"2023-11-14T15:01:52.000Z","size":68,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-14T19:54:15.172Z","etag":null,"topics":["celery","client","distributed","php","python","queue","tasks"],"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/smuuf.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}},"created_at":"2023-09-01T22:12:50.000Z","updated_at":"2024-02-19T14:16:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"34cc9088-c8c3-4294-8d53-a1ad5c4ed12b","html_url":"https://github.com/smuuf/celery-for-php","commit_stats":null,"previous_names":["smuuf/celery-for-php"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smuuf%2Fcelery-for-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smuuf%2Fcelery-for-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smuuf%2Fcelery-for-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smuuf%2Fcelery-for-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smuuf","download_url":"https://codeload.github.com/smuuf/celery-for-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244543719,"owners_count":20469550,"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":["celery","client","distributed","php","python","queue","tasks"],"created_at":"2024-10-10T19:49:00.495Z","updated_at":"2025-03-20T03:30:41.859Z","avatar_url":"https://github.com/smuuf.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# celery-for-php 🌱\n\n[![PHP tests](https://github.com/smuuf/celery-for-php/actions/workflows/php.yml/badge.svg)](https://github.com/smuuf/celery-for-php/actions/workflows/php.yml)\n\nA modern PHP client library for [Celery - Distributed Task Queue](https://docs.celeryq.dev).\n\n## Requirements\n- PHP 8.0+\n\n## Installation\n\nInstall [celery-for-php](https://packagist.org/packages/smuuf/celery-for-php) via Composer.\n\n```bash\ncomposer require smuuf/celery-for-php\n```\n\n### Redis (Predis)\n\nIf you want to use Redis as a broker and/or result backend, celery-for-php contains a Redis driver backed by [`Predis`](https://github.com/predis/predis).\n\nThe Predis `Client` object then needs to be wrapped in our `Smuuf\\CeleryForPhp\\Drivers\\PredisRedisDriver` driver object, which provides the necessary interface for celery-for-php's actual communication with Redis.\n\n#### Example usage\n\n```php\n\u003c?php\n\nuse Predis\\Client as PredisClient;\n\nuse Smuuf\\CeleryForPhp\\Celery;\nuse Smuuf\\CeleryForPhp\\TaskSignature;\nuse Smuuf\\CeleryForPhp\\Brokers\\RedisBroker;\nuse Smuuf\\CeleryForPhp\\Drivers\\PredisRedisDriver;\nuse Smuuf\\CeleryForPhp\\Backends\\RedisBackend;\n\n$predis = new PredisClient(['host' =\u003e '127.0.0.1']);\n$redisDriver = new PredisRedisDriver($predis);\n\n$celery = new Celery(\n\tnew RedisBroker($redisDriver),\n\tnew RedisBackend($redisDriver),\n\t// Optionally explicit config object.\n\t// config: new \\Smuuf\\CeleryForPhp\\Config(...)\n);\n\n$task = new TaskSignature(\n\ttaskName: 'my_celery_app.add_numbers',\n\tqueue: 'my_queue', // Optional, 'celery' by default.\n\targs: [1, 3, 5],\n\t// kwargs: ['arg_a' =\u003e 123, 'arg_b' =\u003e 'something'],\n\t// eta: 'now +10 minutes',\n\t// ... or more optional arguments.\n);\n\n// Send the task into Celery.\n$asyncResult = $celery-\u003esendTask($task);\n\n// Wait for the result (up to 10 seconds by default) and return it.\n// Alternatively a \\Smuuf\\CeleryForPhp\\Exc\\CeleryTimeoutException exception will\n// be thrown if the task won't finish in time.\n$result = $asyncResult-\u003eget();\n// $result === 9\n```\n\n### AMQP/RabbitMQ (PhpAmqpLib)\n\nYou can use AMQP/RabbitMQ as the broker instead, with Redis as the backend. celery-for-php contains a AMQP driver backed by [`PhpAmqpLib`](https://github.com/php-amqplib/php-amqplib).\n\nThe PhpAmqpLib `AMQPConnection` or `AMQPSSLConnection` object needs to be wrapped in our `Smuuf\\CeleryForPhp\\Drivers\\PhpAmqpLibAmqpDriver` driver object, which provides the necessary interface for celery-for-php's actual communication via AMQP.\n\n#### Example usage\n\n```php\n\u003c?php\n\nuse Predis\\Client as PredisClient;\n\nuse Smuuf\\CeleryForPhp\\Celery;\nuse Smuuf\\CeleryForPhp\\TaskSignature;\nuse Smuuf\\CeleryForPhp\\Brokers\\AmqpBroker;\nuse Smuuf\\CeleryForPhp\\Drivers\\PredisRedisDriver;\nuse Smuuf\\CeleryForPhp\\Drivers\\PhpAmqpLibAmqpDriver;\nuse PhpAmqpLib\\Connection\\AMQPSSLConnection;\nuse Smuuf\\CeleryForPhp\\Backends\\RedisBackend;\n\n//$amqpConn = new AMQPConnection(['127.0.0.1', '5672', '', '', '/']);\n$amqpConn = new AMQPSSLConnection(['127.0.0.1', '5672', '', '', '/', ['verify_peer'=\u003efalse]]);\n$amqpDriver = new PhpAmqpLibAmqpDriver($amqpConn);\n\n$predis = new PredisClient(['host' =\u003e '127.0.0.1']);\n$redisDriver = new PredisRedisDriver($predis);\n\n$celery = new Celery(\n\tnew AmqpBroker($amqpDriver),\n\tnew RedisBackend($redisDriver),\n\t// Optionally explicit config object.\n\t// config: new \\Smuuf\\CeleryForPhp\\Config(...)\n);\n\n$task = new TaskSignature(\n\ttaskName: 'my_celery_app.add_numbers',\n\tqueue: 'my_queue', // Optional, 'celery' by default.\n\targs: [1, 3, 5],\n\t// kwargs: ['arg_a' =\u003e 123, 'arg_b' =\u003e 'something'],\n\t// eta: 'now +10 minutes',\n\t// ... or more optional arguments.\n);\n\n// Send the task into Celery.\n$asyncResult = $celery-\u003esendTask($task);\n\n// Wait for the result (up to 10 seconds by default) and return it.\n// Alternatively a \\Smuuf\\CeleryForPhp\\Exc\\CeleryTimeoutException exception will\n// be thrown if the task won't finish in time.\n$result = $asyncResult-\u003eget();\n// $result === 9\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmuuf%2Fcelery-for-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmuuf%2Fcelery-for-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmuuf%2Fcelery-for-php/lists"}