Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bramdevries committed Jul 10, 2015
1 parent 14514f2 commit 77d659b
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Arrounded/queues

> An optionated helper for dealing with queues
[![Build Status](http://img.shields.io/travis/arrounded/queues.svg?style=flat-square)](https://travis-ci.org/arrounded/queues)
[![Latest Stable Version](http://img.shields.io/packagist/v/arrounded/queues.svg?style=flat-square)](https://packagist.org/packages/arrounded/queues)
[![Total Downloads](http://img.shields.io/packagist/dt/arrounded/queues.svg?style=flat-square)](https://packagist.org/packages/arrounded/queues)
Expand All @@ -16,7 +18,75 @@ $ composer require arrounded/queues

## Usage

How the module works
First add the module's service provider and facade to config/app.php:

```php
Arrounded\Queues\ServiceProvider::class
```

```php
'Queues' => Arrounded\Queues\Facades\Queues::class,
```

Now you can start using the helper in your application code via the Facade:

### Pushing jobs

```php
Queues::on('foo')->uses(Foobar::class)->push()
```

This will push a job on the `local_foo_normal` queue.

__Priorities__

```php
Queues::on('foo')->uses(Foobar::class)->priority(Queues::PRIORITY_HIGH)->push();
```

This will push a job on the `local_foo_high` queue.

__Passing a payload__

```php
Queues::on('foo')->uses(Foobar::class)->with([
'bar' => 'foo'
])->push();
```

This will push a job on the `local_foo_normal` queue with a `{'bar': 'foo'}` payload

__Delaying execution__

```php
Queues::on('foo')->uses(Foobar::class)->delay(10)->push();
```

This will delay the execution of the job by 10 seconds.

### Prefixing queue names

The default behavior is to prefix all queues with the current app environment. If you want to overwrite this default on an application level, you can do it in your own
ServiceProvider:

```php
$this->app['queues']->setPrefix('foobar') // foobar_foo_normal
```

### Dependency Injection

You can also use dependency injection:

```php
use Arrounded\Queues\Queues;

class FooService
{
public function __construct(Queues $queues)
{
$this->queues = $queues;
}
```

## Testing

Expand Down

0 comments on commit 77d659b

Please sign in to comment.