QueueYii Extension ¶
Simple queue processor extension for Yii 1.1.*
Requirements ¶
- PHP 5.3 >
- Yii 1.1.*
Installation ¶
Download the extension package.
Unzip in extension folder
Add in your config/console.php
:
...
'import' => array(
...,
'application.extensions.*',
),
'classMap' => array(
'queue' => 'application.extensions.queueyii.command.queueCommand
)
Example Job ¶
Your jobs class should like this:
<?php
/**
* Class ExampleJob
*/
class ExampleJob extends Job
{
/**
* @var string
*/
private $string;
public function __construct($string)
{
$this->string = $string;
}
/**
* Exec example job
*/
public function exec()
{
// add you code here
echo "Running job " . $this->string;
}
}
Adde jobs to queue ¶
You can add a new job on queue with this code:
Jobs::enqueue(new ExampleJob('string');
Running the queue ¶
Using the yiic, you can run the queue, running this command:
php yiic queue listem --delay=5
You can parse the param delay, for add one interval between the jobs. The param delay is not required.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.