cberio / azure-queue-laravel

PHP Laravel 5 Queue Driver package for Microsoft Azure Storage Queues

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

azure-queue-laravel

Build Status Coverage Status

Latest Stable Version Total Downloads

PHP Laravel 5 Queue Driver package to support Microsoft Azure Storage Queues

Prerequisites

  • PHP 5.6+
  • Laravel 5.2, 5.3 and 5.4 (not tested on previous versions)
  • Microsoft Azure Storage account and API key
  • Queue container created through Azure Portal or via Azure CLI / PowerShell

Installation

Install by composer

You can find this library on Packagist.

Require this package in your composer.json. The version numbers will follow Laravel.

Laravel 5.2.x

"squigg/azure-queue-laravel": "5.2.*"
composer require squigg/azure-queue-laravel:5.2.* 

Laravel 5.3.x

"squigg/azure-queue-laravel": "5.3.*"
composer require squigg/azure-queue-laravel:5.3.*

Laravel 5.4.x

"squigg/azure-queue-laravel": "5.4.*"
composer require squigg/azure-queue-laravel:5.4.*

Add the following pear repository in your composer.json file required for the Microsoft Azure SDK (not required for 5.4.x which uses the new microsoft/azure-storage package):

"repositories": [
    {
        "type": "pear",
        "url": "http://pear.php.net"
    }
],

Update Composer dependencies

composer update

Configuration

Add the ServiceProvider to your providers array in config/app.php:

'Squigg\AzureQueueLaravel\AzureQueueServiceProvider',

add the following to the connection array in config/queue.php, set your default connection to azure and fill out your own connection data from the Azure Management portal:

'azure' => [
    'driver'        => 'azure',         // Leave this as-is
    'protocol'      => 'https',         // https or http
    'accountname'   => '',              // Azure storage account name
    'key'           => '',              // Access key for storage account
    'queue'         => '',              // Queue container name
    'timeout'       => 60               // Timeout (seconds) before a job is released back to the queue
],

You can add environment variables into your .env file to set the above configuration parameters if you desire:

AZURE_QUEUE_STORAGE_NAME=xxx
AZURE_QUEUE_KEY=xxx
AZURE_QUEUE_NAME=xxx

And then update the config file like below:

'accountname'   => env('AZURE_QUEUE_STORAGE_NAME'),   
'key'           => env('AZURE_QUEUE_KEY'),   
'queue'         => env('AZURE_QUEUE_NAME'),   

Usage

Use the normal Laravel Queue functionality as per the documentation.

Remember to update the default queue by setting the QUEUE_DRIVER value in your .env file to azure.

Changelog

Will be added once stuff starts changing.

License

Released under the MIT License. Based on Alex Bouma's Laravel 4 package, updated for Laravel 5.

About

PHP Laravel 5 Queue Driver package for Microsoft Azure Storage Queues


Languages

Language:PHP 98.8%Language:Shell 1.2%