ayles-software/laravel-cloudflare-queue
最新稳定版本:0.3.1
Composer 安装命令:
composer require ayles-software/laravel-cloudflare-queue
包简介
Cloudflare queue driver for laravel.
README 文档
README
A Laravel queue driver for Cloudflare Queues. This is still a work in progress.
Configuration
Add the following to your config/queue.php file:
'cloudflare' => [ 'driver' => 'cloudflare', 'account_id'=> env('CLOUDFLARE_ACCOUNT_ID'), 'queue_id' => env('CLOUDFLARE_QUEUE_ID'), 'api_token' => env('CLOUDFLARE_API_TOKEN'), ],
If are using CF workers and pushing raw jobs, you can set a raw handler that will be used to process the raw job:
'cloudflare' => [ 'driver' => 'cloudflare', 'raw_handler' => CloudflareRawJobHandler::class, 'account_id'=> env('CLOUDFLARE_ACCOUNT_ID'), 'queue_id' => env('CLOUDFLARE_QUEUE_ID'), 'api_token' => env('CLOUDFLARE_API_TOKEN'), ],
Example of a raw CF job:
class WebhookEmailEvent implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; public function __construct(public readonly array $data) { // } public function handle() { // do something } }
Example of pushing a raw CF job to a Queue using JS:
export default { async fetch(request, env, context) { await env.MY_QUEUE.send({ food: "lemons", }); return new Response('Ok'); } }
Testing
This package includes a comprehensive test suite using Pest PHP. To run the tests:
-
Install dependencies:
composer install
-
Run the tests:
./vendor/bin/pest
统计信息
- 总下载量: 694
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-28