Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

Commit 58b1d0d

Browse files
committed
first
0 parents  commit 58b1d0d

12 files changed

+838
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/vendor
2+
/.env
3+
composer.phar
4+
composer.lock
5+
.DS_Store
6+
Thumbs.db

.travis.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: php
2+
3+
php:
4+
- 5.5
5+
- 5.6
6+
- hhvm
7+
8+
sudo: false
9+
10+
install: travis_retry composer install --no-interaction --prefer-source
11+
12+
script: vendor/bin/phpunit --verbose

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) <Taylor Otwell>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

composer.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "laravelcollective/iron-queue",
3+
"description": "IronMQ support for the Laravel queue.",
4+
"license": "MIT",
5+
"homepage": "http://laravelcollective.com",
6+
"support": {
7+
"issues": "https://github.com/laravelcollective/iron-queue/issues",
8+
"source": "https://github.com/laravelcollective/iron-queue"
9+
},
10+
"authors": [
11+
{
12+
"name": "Taylor Otwell",
13+
"email": "[email protected]"
14+
}
15+
],
16+
"require": {
17+
"php": ">=5.5.9",
18+
"illuminate/container": "5.2.*",
19+
"illuminate/contracts": "5.2.*",
20+
"illuminate/encryption": "5.2.*",
21+
"illuminate/http": "5.2.*",
22+
"illuminate/queue": "5.2.*",
23+
"illuminate/support": "5.2.*",
24+
"iron-io/iron_mq": "~2.0",
25+
"jeremeamia/superclosure": "~2.0"
26+
},
27+
"require-dev": {
28+
"mockery/mockery": "~0.9",
29+
"phpunit/phpunit": "~4.0"
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"Collective\\IronQueue\\": "src/"
34+
}
35+
},
36+
"extra": {
37+
"branch-alias": {
38+
"dev-master": "5.3-dev"
39+
}
40+
},
41+
"minimum-stability": "dev"
42+
}

phpunit.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
>
13+
<testsuites>
14+
<testsuite name="Package Test Suite">
15+
<directory suffix=".php">./tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
</phpunit>

readme.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# IronMQ Laravel Queue Driver
2+
3+
This package provides a IronMQ (~2.0 SDK) driver for the Laravel queue system and matches the driver that was found in Laravel 5.1.
4+
5+
## Installation
6+
7+
- Add `Collective\IronQueue\IronQueueServiceProvider` to your `app.php` configuration file.
8+
- Configure your `iron` queue driver in your `config/queue.php` the same as it would have been configured for Laravel 5.1.
9+
10+
Sample Configuration:
11+
12+
```php
13+
'iron' => [
14+
'driver' => 'iron',
15+
'host' => 'mq-aws-us-east-1.iron.io',
16+
'token' => 'your-token',
17+
'project' => 'your-project-id',
18+
'queue' => 'your-queue-name',
19+
'encrypt' => true,
20+
],
21+
```

src/Connectors/IronConnector.php

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
namespace Collective\IronQueue\Connectors;
4+
5+
use IronMQ\IronMQ;
6+
use Illuminate\Http\Request;
7+
use Collective\IronQueue\IronQueue;
8+
use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract;
9+
10+
class IronConnector implements ConnectorInterface
11+
{
12+
/**
13+
* The encrypter instance.
14+
*
15+
* @var \Illuminate\Encryption\Encrypter
16+
*/
17+
protected $crypt;
18+
19+
/**
20+
* The current request instance.
21+
*
22+
* @var \Illuminate\Http\Request
23+
*/
24+
protected $request;
25+
26+
/**
27+
* Create a new Iron connector instance.
28+
*
29+
* @param \Illuminate\Contracts\Encryption\Encrypter $crypt
30+
* @param \Illuminate\Http\Request $request
31+
* @return void
32+
*/
33+
public function __construct(EncrypterContract $crypt, Request $request)
34+
{
35+
$this->crypt = $crypt;
36+
$this->request = $request;
37+
}
38+
39+
/**
40+
* Establish a queue connection.
41+
*
42+
* @param array $config
43+
* @return \Illuminate\Contracts\Queue\Queue
44+
*/
45+
public function connect(array $config)
46+
{
47+
$ironConfig = ['token' => $config['token'], 'project_id' => $config['project']];
48+
49+
if (isset($config['host'])) {
50+
$ironConfig['host'] = $config['host'];
51+
}
52+
53+
$iron = new IronMQ($ironConfig);
54+
55+
if (isset($config['ssl_verifypeer'])) {
56+
$iron->ssl_verifypeer = $config['ssl_verifypeer'];
57+
}
58+
59+
return new IronQueue($iron, $this->request, $config['queue'], $config['encrypt']);
60+
}
61+
}

0 commit comments

Comments
 (0)