{"id":23007248,"url":"https://github.com/garbetjie/laravel-database-queue","last_synced_at":"2026-04-18T17:31:46.442Z","repository":{"id":62509040,"uuid":"266107751","full_name":"garbetjie/laravel-database-queue","owner":"garbetjie","description":"Laravel queue driver for the database with optimistic queue locking.","archived":false,"fork":false,"pushed_at":"2021-03-11T07:50:47.000Z","size":27,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-08T06:16:21.021Z","etag":null,"topics":["database","laravel","laravel-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/garbetjie.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":"2020-05-22T12:41:31.000Z","updated_at":"2021-08-11T06:45:53.000Z","dependencies_parsed_at":"2022-11-02T10:30:45.778Z","dependency_job_id":null,"html_url":"https://github.com/garbetjie/laravel-database-queue","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garbetjie%2Flaravel-database-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garbetjie%2Flaravel-database-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garbetjie%2Flaravel-database-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garbetjie%2Flaravel-database-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garbetjie","download_url":"https://codeload.github.com/garbetjie/laravel-database-queue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246837615,"owners_count":20841906,"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":["database","laravel","laravel-queue"],"created_at":"2024-12-15T08:14:59.800Z","updated_at":"2026-04-18T17:31:41.414Z","avatar_url":"https://github.com/garbetjie.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Database Queue Driver\n\nA database queue driver for Laravel with optimistic locking and job count caching. Heavily inspired by the article at\nhttps://ph4r05.deadcode.me/blog/2017/12/23/laravel-queues-optimization.html, and the relevant package at\nhttps://github.com/ph4r05/laravel-queue-database-ph4. \n\n## Installation\n\n1. Install this package using composer:\n```\ncomposer require garbetjie/laravel-database-queue\n```\n\n2. Run the migration to alter the jobs table.\n   If you haven't yet run the command to create the jobs table, do so first (`./artisan queue:table`).\n```\nphp artisan garbetjie:database-queue:table\nphp artisan migrate\n```\n\n3. Replace the `database` driver in your queue connection with `database-garbetjie`:\n```php\n\u003c?php\n// In config/queue.php:\n\nreturn [\n    'connections' =\u003e [\n        'database' =\u003e [\n            'driver' =\u003e 'database-garbetjie',\n            'table' =\u003e 'jobs',\n            'queue' =\u003e 'default',\n            'retry_after' =\u003e 60,\n            'prefetch' =\u003e 5,\n            'shuffle' =\u003e true,\n        ]\n    ], \n];\n```\n\n4. Optionally, you can also create a \"cache\" table for job counts.\n   \n   If you have many jobs in your queue, running a query like `SELECT queue, COUNT(*) FROM jobs GROUP BY 1` can take a\n   long time to yield results. Run the following command to generate migrations that will create a job count cache table, and will keep the job counts\n   updated through the use of triggers.\n```\nphp artisan garbetjie:database-queue:table-job-counts\nphp artisan migrate\n```\n\n### Configuration\n\nThis queue driver extends the default `database` queue driver. As a result, the configuration for this queue driver is\nexactly the same as the original database queue driver (https://laravel.com/docs/7.x/queues#driver-prerequisites), except\nfor some additional configuration options:\n\n| Name     | Type | Default | Description                                                                                                                               |\n|----------|------|---------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| prefetch | int  | 5       | Determines how many queue jobs to fetch before attempting to reserve one. Should ideally default to the number of workers for your queue. |\n| shuffle  | bool | true    | Whether or not to shuffle fetched jobs before attempting to reserve one.                                                                  |\n\n## Changelog\n\n* **1.3.2**\n    * Exclude `laravel/database` versions `\u003e=7.30.3 \u003c8.0`, due to Dependabot alert.\n* **1.3.1**\n    * Exclude `laravel/database` versions `\u003e= 8.0 \u003c8.22.1`, due to Dependabot alert.\n\n* **1.3.0**\n    * Add support for Laravel 8.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarbetjie%2Flaravel-database-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarbetjie%2Flaravel-database-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarbetjie%2Flaravel-database-queue/lists"}