akayaman / azure-queue-laravel
Microsoft Azure Storage Queue 的 Laravel 5 队列驱动程序
v5.6.0
2018-02-07 23:53 UTC
Requires
- php: ^7.1
- illuminate/queue: 5.6.*
- microsoft/azure-storage-queue: ^1.0
Requires (Dev)
- mockery/mockery: ~1.0
- orchestra/testbench: 3.6.*
- phpunit/phpunit: ~7.0
- satooshi/php-coveralls: ~2.0
README
PHP Laravel 5 Queue Driver 包,支持 Microsoft Azure Storage Queues
先决条件
- PHP 7+ 用于 Laravel 5.5+
- Laravel 5.5 (未在旧版本上进行测试)
- Microsoft Azure 存储帐户和 API 密钥
- 通过 Azure Portal 或 Azure CLI / PowerShell 创建的队列容器
安装
使用 composer 安装
您可以在 Packagist 上找到这个库。
在您的 composer.json
文件中要求此包。版本号将遵循 Laravel。
Laravel 5.5.x
"akayaman/azure-queue-laravel": "5.5.*"
composer require akayaman/azure-queue-laravel:5.5.*
配置
添加提供者
如果您没有使用 Laravel 自动包发现,请将 ServiceProvider 添加到您的 config/app.php
文件中的 providers
数组中
'Squigg\AzureQueueLaravel\AzureQueueServiceProvider',
添加 Azure 队列配置
将以下内容添加到 config/queue.php
文件中的 connections
数组中,并填写从 Azure 管理门户获取的自己的连接数据
'azure' => [
'driver' => 'azure', // Leave this as-is
'protocol' => 'https', // https or http
'accountname' => env('AZURE_QUEUE_STORAGE_NAME'), // Azure storage account name
'key' => env('AZURE_QUEUE_KEY'), // Access key for storage account
'queue' => env('AZURE_QUEUE_NAME'), // Queue container name
'endpoint' => env('AZURE_QUEUE_ENDPOINT'), // Queue endpoint
'timeout' => 60 // Timeout (seconds) before a job is released back to the queue
],
如果您愿意,请将环境变量添加到您的 .env
文件中,以设置上述配置参数
AZURE_QUEUE_STORAGE_NAME=xxx
AZURE_QUEUE_KEY=xxx
AZURE_QUEUE_NAME=xxx
AZURE_QUEUE_ENDPOINT=xxx
设置默认 Laravel 队列
通过将您的 .env
文件中的 QUEUE_DRIVER
值设置为 azure
来更新 Laravel 使用的默认队列。
QUEUE_DRIVER=azure
使用
根据 文档 使用正常的 Laravel 队列功能。
请记住,通过将您的 .env
文件中的 QUEUE_DRIVER
值设置为 azure
来更新默认队列。
许可证
在 MIT 许可证下发布。基于 Alex Bouma 的 Laravel 4 包,针对 Laravel 5 进行了更新。