{"id":13411422,"url":"https://github.com/yiisoft/yii2-queue","last_synced_at":"2025-05-13T15:09:17.003Z","repository":{"id":41329518,"uuid":"72430005","full_name":"yiisoft/yii2-queue","owner":"yiisoft","description":"Yii2 Queue Extension. Supports DB, Redis, RabbitMQ, Beanstalk and Gearman","archived":false,"fork":false,"pushed_at":"2025-03-11T14:00:59.000Z","size":995,"stargazers_count":1067,"open_issues_count":70,"forks_count":293,"subscribers_count":75,"default_branch":"master","last_synced_at":"2025-05-01T11:37:02.630Z","etag":null,"topics":["amqp","async","beanstalk","gearman","hacktoberfest","queue","rabbitmq","redis","yii2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiisoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["yiisoft"],"open_collective":"yiisoft","tidelift":"packagist/yiisoft/yii2-queue"}},"created_at":"2016-10-31T11:25:15.000Z","updated_at":"2025-04-29T21:27:01.000Z","dependencies_parsed_at":"2023-11-09T15:04:36.807Z","dependency_job_id":"ececbd0f-0e0b-49f6-b662-d30bd493bf96","html_url":"https://github.com/yiisoft/yii2-queue","commit_stats":{"total_commits":487,"total_committers":64,"mean_commits":7.609375,"dds":0.3613963039014374,"last_synced_commit":"46b2eff9d89762fdf8af63ffa4fba72bf77a3457"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fyii2-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fyii2-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fyii2-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fyii2-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiisoft","download_url":"https://codeload.github.com/yiisoft/yii2-queue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252071666,"owners_count":21690074,"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":["amqp","async","beanstalk","gearman","hacktoberfest","queue","rabbitmq","redis","yii2"],"created_at":"2024-07-30T20:01:13.563Z","updated_at":"2025-05-13T15:09:16.941Z","avatar_url":"https://github.com/yiisoft.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/yiisoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://avatars0.githubusercontent.com/u/993323\" height=\"100px\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003eYii2 Queue Extension\u003c/h1\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\nAn extension for running tasks asynchronously via queues.\n\nIt supports queues based on **DB**, **Redis**, **RabbitMQ**, **AMQP**, **Beanstalk**, **ActiveMQ** and **Gearman**.\n\nDocumentation is at [docs/guide/README.md](docs/guide/README.md).\n\n[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-queue/v/stable.svg)](https://packagist.org/packages/yiisoft/yii2-queue)\n[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-queue/downloads.svg)](https://packagist.org/packages/yiisoft/yii2-queue)\n[![Build Status](https://github.com/yiisoft/yii2-queue/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-queue/actions)\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](https://getcomposer.org/download/):\n\n```\nphp composer.phar require --prefer-dist yiisoft/yii2-queue\n```\n\nBasic Usage\n-----------\n\nEach task which is sent to queue should be defined as a separate class.\nFor example, if you need to download and save a file the class may look like the following:\n\n```php\nclass DownloadJob extends BaseObject implements \\yii\\queue\\JobInterface\n{\n    public $url;\n    public $file;\n    \n    public function execute($queue)\n    {\n        file_put_contents($this-\u003efile, file_get_contents($this-\u003eurl));\n    }\n}\n```\n\nHere's how to send a task into the queue:\n\n```php\nYii::$app-\u003equeue-\u003epush(new DownloadJob([\n    'url' =\u003e 'http://example.com/image.jpg',\n    'file' =\u003e '/tmp/image.jpg',\n]));\n```\nTo push a job into the queue that should run after 5 minutes:\n\n```php\nYii::$app-\u003equeue-\u003edelay(5 * 60)-\u003epush(new DownloadJob([\n    'url' =\u003e 'http://example.com/image.jpg',\n    'file' =\u003e '/tmp/image.jpg',\n]));\n```\n\nThe exact way a task is executed depends on the used driver. Most drivers can be run using\nconsole commands, which the component automatically registers in your application.\n\nThis command obtains and executes tasks in a loop until the queue is empty:\n\n```sh\nyii queue/run\n```\n\nThis command launches a daemon which infinitely queries the queue:\n\n```sh\nyii queue/listen\n```\n\nSee the documentation for more details about driver specific console commands and their options.\n\nThe component also has the ability to track the status of a job which was pushed into queue.\n\n```php\n// Push a job into the queue and get a message ID.\n$id = Yii::$app-\u003equeue-\u003epush(new SomeJob());\n\n// Check whether the job is waiting for execution.\nYii::$app-\u003equeue-\u003eisWaiting($id);\n\n// Check whether a worker got the job from the queue and executes it.\nYii::$app-\u003equeue-\u003eisReserved($id);\n\n// Check whether a worker has executed the job.\nYii::$app-\u003equeue-\u003eisDone($id);\n```\n\nFor more details see [the guide](docs/guide/README.md).\n","funding_links":["https://github.com/sponsors/yiisoft","https://opencollective.com/yiisoft","https://tidelift.com/funding/github/packagist/yiisoft/yii2-queue"],"categories":["Extension 扩展","PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fyii2-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiisoft%2Fyii2-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fyii2-queue/lists"}