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

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 6, 2015
0 parents commit 58b1d0d
Show file tree
Hide file tree
Showing 12 changed files with 838 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
/vendor
/.env
composer.phar
composer.lock
.DS_Store
Thumbs.db
12 changes: 12 additions & 0 deletions .travis.yml
@@ -0,0 +1,12 @@
language: php

php:
- 5.5
- 5.6
- hhvm

sudo: false

install: travis_retry composer install --no-interaction --prefer-source

script: vendor/bin/phpunit --verbose
21 changes: 21 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) <Taylor Otwell>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
42 changes: 42 additions & 0 deletions composer.json
@@ -0,0 +1,42 @@
{
"name": "laravelcollective/iron-queue",
"description": "IronMQ support for the Laravel queue.",
"license": "MIT",
"homepage": "http://laravelcollective.com",
"support": {
"issues": "https://github.com/laravelcollective/iron-queue/issues",
"source": "https://github.com/laravelcollective/iron-queue"
},
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
}
],
"require": {
"php": ">=5.5.9",
"illuminate/container": "5.2.*",
"illuminate/contracts": "5.2.*",
"illuminate/encryption": "5.2.*",
"illuminate/http": "5.2.*",
"illuminate/queue": "5.2.*",
"illuminate/support": "5.2.*",
"iron-io/iron_mq": "~2.0",
"jeremeamia/superclosure": "~2.0"
},
"require-dev": {
"mockery/mockery": "~0.9",
"phpunit/phpunit": "~4.0"
},
"autoload": {
"psr-4": {
"Collective\\IronQueue\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"minimum-stability": "dev"
}
18 changes: 18 additions & 0 deletions phpunit.xml
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
21 changes: 21 additions & 0 deletions readme.md
@@ -0,0 +1,21 @@
# IronMQ Laravel Queue Driver

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.

## Installation

- Add `Collective\IronQueue\IronQueueServiceProvider` to your `app.php` configuration file.
- Configure your `iron` queue driver in your `config/queue.php` the same as it would have been configured for Laravel 5.1.

Sample Configuration:

```php
'iron' => [
'driver' => 'iron',
'host' => 'mq-aws-us-east-1.iron.io',
'token' => 'your-token',
'project' => 'your-project-id',
'queue' => 'your-queue-name',
'encrypt' => true,
],
```
61 changes: 61 additions & 0 deletions src/Connectors/IronConnector.php
@@ -0,0 +1,61 @@
<?php

namespace Collective\IronQueue\Connectors;

use IronMQ\IronMQ;
use Illuminate\Http\Request;
use Collective\IronQueue\IronQueue;
use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract;

class IronConnector implements ConnectorInterface
{
/**
* The encrypter instance.
*
* @var \Illuminate\Encryption\Encrypter
*/
protected $crypt;

/**
* The current request instance.
*
* @var \Illuminate\Http\Request
*/
protected $request;

/**
* Create a new Iron connector instance.
*
* @param \Illuminate\Contracts\Encryption\Encrypter $crypt
* @param \Illuminate\Http\Request $request
* @return void
*/
public function __construct(EncrypterContract $crypt, Request $request)
{
$this->crypt = $crypt;
$this->request = $request;
}

/**
* Establish a queue connection.
*
* @param array $config
* @return \Illuminate\Contracts\Queue\Queue
*/
public function connect(array $config)
{
$ironConfig = ['token' => $config['token'], 'project_id' => $config['project']];

if (isset($config['host'])) {
$ironConfig['host'] = $config['host'];
}

$iron = new IronMQ($ironConfig);

if (isset($config['ssl_verifypeer'])) {
$iron->ssl_verifypeer = $config['ssl_verifypeer'];
}

return new IronQueue($iron, $this->request, $config['queue'], $config['encrypt']);
}
}

0 comments on commit 58b1d0d

Please sign in to comment.