99designs / sera
Asynchronous task execution library
Installs: 9 602
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 50
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
- 99designs/ergo: ~2.6
Requires (Dev)
- mockery/mockery: >=0.7.2
- phpunit/phpunit: 3.7.*
Suggests
- pda/pheanstalk: Supports beanstalkd as a queue type
This package is not auto-updated.
Last update: 2020-01-24 14:52:32 UTC
README
Allows for long-running or asynchronous tasks to be written as Tasks and queued on a variety on queuing mechanism.
Currently supports Beanstalk and Amazon SQS.
Installation
To add sera to a project, the easiest way is via composer:
{ "require": { "99designs/sera": ">=1.0.0" } }
Usage
<?php // a simple task class MyTask extends Sera_Task_Abstract { public static function create($params) { return new self($params); } public function execute() { my_long_running_function($this->_data); } } // a queue that connects to beanstalkd $queue = new Sera_Queue_BeanstalkQueue("127.0.0.1"); $queue->select('llama_tasks'); // enqueue the task $queue->enqueue(MyTask::create('some data')); // normally this would be in a seperate process $worker = new Sera_Queue_QueueWorker($queue); $worker->execute();
Copyright
Copyright (c) 2012 99designs See LICENSE for details.