richan-fongdasen / laravel-gcr-worker
在 Laravel 中轻松生成 RESTful API 端点
1.6.0
2024-03-13 10:57 UTC
Requires
- php: ^8.0
- illuminate/console: ^8.0|^9.0|^10.0|^11.0
- illuminate/queue: ^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
- kainxspirits/laravel-pubsub-queue: ^0.6|^0.7|^0.8|^0.9
Requires (Dev)
- ekino/phpstan-banned-code: ^1.0
- larastan/larastan: ^1.0|^2.0
- mockery/mockery: ^1.4
- orchestra/testbench: ^6.0|^7.0|^8.0|^9.0
- phpmd/phpmd: ^2.11
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-strict-rules: ^1.0
- phpunit/phpunit: ^9.5|^10.0|^11.0
README
Laravel GCR Worker
使用 Google Cloud Run 和 Google Cloud Pub/Sub 的简单后台处理实现
摘要
此包可以帮助您通过处理触发的 HTTP 事件调用,在 Google Cloud Run 中实现 Laravel 中的任何后台处理,如队列工作或计划任务。
目录
设置
通过 Composer 安装此包
$ composer require richan-fongdasen/laravel-gcr-worker
Laravel 版本兼容性
配置
使用 php artisan
命令发布配置文件
$ php artisan vendor:publish --provider="RichanFongdasen\GCRWorker\ServiceProvider"
上面的命令会将新的配置文件复制到 /config/gcr-worker.php
return [ /* |-------------------------------------------------------------------------- | Allow Event invocation |-------------------------------------------------------------------------- | | Specify whether the application would allow and handle any event | invocations, such as Pub/Sub topic message published events, Cloud | scheduler jobs, etc. | */ 'allow_event_invocation' => (bool) env('ALLOW_EVENT_INVOCATION', false), /* |-------------------------------------------------------------------------- | Maximum Execution Time |-------------------------------------------------------------------------- | | Set the max execution time in seconds, the default value is 15 minutes. | | Warning: | This value doesn't update the maximum execution time defined in your | nginx, apache or php-fpm configuration. You need to update them manually. | */ 'max_execution_time' => 60 * 15, /* |-------------------------------------------------------------------------- | Middleware |-------------------------------------------------------------------------- | | Define the middleware which should be attached in every GCR worker route. | */ 'middleware' => [ \Illuminate\Routing\Middleware\SubstituteBindings::class, \RichanFongdasen\GCRWorker\Middleware\AllowEventInvocation::class, ], /* |-------------------------------------------------------------------------- | Path prefix |-------------------------------------------------------------------------- | | Define the path prefix of the Pub/Sub event handler url. | */ 'path_prefix' => 'gcr-worker', ];
用法
本节内容正在开发中。
许可证
MIT 许可证(MIT)。请参阅 许可证文件 以获取更多信息。