Skip to content

Commit

Permalink
Update for Laravel 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
squigg committed Sep 12, 2017
1 parent 043fccd commit 65e2084
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
20 changes: 13 additions & 7 deletions README.md
Expand Up @@ -11,14 +11,14 @@ 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)
- PHP 5.6+, PHP7+ for Laravel 5.5+
- Laravel 5.2, 5.3, 5.4 and 5.5 (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
### Install using composer
You can find this library on [Packagist](https://packagist.org/packages/squigg/azure-queue-laravel).

Require this package in your `composer.json`. The version numbers will follow Laravel.
Expand All @@ -31,9 +31,12 @@ Require this package in your `composer.json`. The version numbers will follow La
#### Laravel 5.4.x
"squigg/azure-queue-laravel": "5.4.*"
composer require squigg/azure-queue-laravel:5.4.*
#### Laravel 5.5.x
"squigg/azure-queue-laravel": "5.5.*"
composer require squigg/azure-queue-laravel:5.5.*

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):
For versions 5.3 and older, add the following pear repository in your `composer.json` file
required for the Microsoft Azure SDK (v5.4+ uses the new `microsoft/azure-storage` package instead):

"repositories": [
{
Expand All @@ -53,7 +56,7 @@ 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
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' => [
Expand All @@ -65,6 +68,8 @@ fill out your own connection data from the Azure Management portal:
'timeout' => 60 // Timeout (seconds) before a job is released back to the queue
],

Update the default queue used by Laravel by setting the `QUEUE_DRIVER` value in your `.env` file to `azure`.

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

AZURE_QUEUE_STORAGE_NAME=xxx
Expand All @@ -83,7 +88,8 @@ Use the normal Laravel Queue functionality as per the [documentation](http://lar
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.
2017-09-11 - V5.5 - Support Laravel 5.5 and PHP7+ only. Update Azure Storage API to 0.18
2017-09-11 - V5.4 - Update Azure Storage API to 0.15 (no breaking changes)

## License
Released under the MIT License. Based on [Alex Bouma's Laravel 4 package](https://github.com/stayallive/laravel-azure-blob-queue), updated for Laravel 5.
13 changes: 7 additions & 6 deletions composer.json
Expand Up @@ -5,7 +5,8 @@
"laravel",
"azure",
"storage",
"queue"
"queue",
"microsoft"
],
"license": "MIT",
"authors": [
Expand All @@ -15,13 +16,13 @@
}
],
"require": {
"php": ">=5.6.0",
"illuminate/queue": "5.4.*",
"microsoft/azure-storage": "~0.15.0"
"php": ">=7.0",
"illuminate/queue": "5.5.*",
"microsoft/azure-storage": "~0.18.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"orchestra/testbench": "3.4.*",
"phpunit/phpunit": "~6.0",
"orchestra/testbench": "3.5.*",
"mockery/mockery": "~1.0@dev",
"satooshi/php-coveralls": "~1.0.1"
},
Expand Down
10 changes: 5 additions & 5 deletions src/AzureJob.php
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Contracts\Queue\Job as JobContract;
use Illuminate\Queue\Jobs\Job;
use MicrosoftAzure\Storage\Queue\Internal\IQueue;
use MicrosoftAzure\Storage\Queue\Models\MicrosoftAzureQueueMessage;
use MicrosoftAzure\Storage\Queue\Models\QueueMessage;
use MicrosoftAzure\Storage\Queue\QueueRestProxy;

class AzureJob extends Job implements JobContract
Expand All @@ -22,7 +22,7 @@ class AzureJob extends Job implements JobContract
/**
* The Azure QueueMessage instance.
*
* @var MicrosoftAzureQueueMessage
* @var QueueMessage
*/
protected $job;

Expand All @@ -38,14 +38,14 @@ class AzureJob extends Job implements JobContract
*
* @param \Illuminate\Container\Container $container
* @param IQueue $azure
* @param MicrosoftAzureQueueMessage $job
* @param QueueMessage $job
* @param string $connectionName
* @param string $queue
*
*/
public function __construct(Container $container,
IQueue $azure,
MicrosoftAzureQueueMessage $job,
QueueMessage $job,
$connectionName,
$queue)
{
Expand Down Expand Up @@ -114,7 +114,7 @@ public function getAzure()
/**
* Get the underlying raw Azure job.
*
* @return MicrosoftAzureQueueMessage
* @return QueueMessage
*/
public function getAzureJob()
{
Expand Down
6 changes: 3 additions & 3 deletions tests/AzureJobTest.php
@@ -1,7 +1,7 @@
<?php

use MicrosoftAzure\Storage\Queue\Internal\IQueue;
use MicrosoftAzure\Storage\Queue\Models\MicrosoftAzureQueueMessage;
use MicrosoftAzure\Storage\Queue\Models\QueueMessage;
use Squigg\AzureQueueLaravel\AzureJob;
use Squigg\AzureQueueLaravel\AzureQueue;

Expand All @@ -19,7 +19,7 @@ class AzureJobTest extends TestCase
protected $queue;

/**
* @var MicrosoftAzureQueueMessage
* @var QueueMessage
*/
protected $message;

Expand All @@ -36,7 +36,7 @@ public function setUp()
$this->queue = new AzureQueue($this->azure, 'myqueue', 5);
$this->queue->setContainer($this->app);

$this->message = new MicrosoftAzureQueueMessage();
$this->message = new QueueMessage();
$this->message->setMessageId('1234');
$this->message->setPopReceipt('9876');
$this->message->setMessageText('{"abcd":"efgh"}');
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/ListMessagesResult.php
@@ -1,5 +1,5 @@
<?php
use MicrosoftAzure\Storage\Queue\Models\MicrosoftAzureQueueMessage;
use MicrosoftAzure\Storage\Queue\Models\QueueMessage;

/**
* Created by PhpStorm.
Expand Down Expand Up @@ -27,6 +27,6 @@ public function __construct($count = 1)
public function getQueueMessages()
{
if ($this->count == 0) return [];
return array_fill(0, $this->count, new MicrosoftAzureQueueMessage());
return array_fill(0, $this->count, new QueueMessage());
}
}

0 comments on commit 65e2084

Please sign in to comment.