arrounded/queues
最新稳定版本:1.0.2
Composer 安装命令:
composer require arrounded/queues
包简介
A set of queue helpers
关键字:
README 文档
README
An optionated helper for dealing with queues
Install
Via Composer
$ composer require arrounded/queues
A Laravel 4.2 version also availabe: composer require arrounded/queues:dev-laravel/4.2
Usage
First add the module's service provider and facade to config/app.php:
Arrounded\Queues\ServiceProvider::class
'Queues' => Arrounded\Queues\Facades\Queues::class,
Now you can start using the helper in your application code via the Facade:
Pushing jobs
Queues::on('foo')->uses(Foobar::class)->push()
This will push a job on the local_foo_normal queue.
Priorities
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
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
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:
$this->app['queues']->setPrefix('foobar') // foobar_foo_normal
Disabling queueing
In some cases you might want to disable queueing all together (for example during integration/functional tests)
// To disable $this->app['queues']->disabled() // To re-enable $this->app['queues']->disabled(false)
Dependency Injection
You can also use dependency injection:
use Arrounded\Queues\Queues; class FooService { public function __construct(Queues $queues) { $this->queues = $queues; }
Testing
$ composer test
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 290
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-11