PHP code example of lucups / presque

1. Go to this page and download the library: Download lucups/presque library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lucups / presque example snippets




class MyJob {

    public function setUp() {
        // Set up environment for this job
    }

	public function perform($args) {
        // Perform some job
    }

    public function tearDown() {
        // Remove environment for this job
    }

}

$job = Resque::push('MyJob', array('arg1', 'arg2'));

$job = Resque::push(function($job) {
    echo 'This is a inline job #'.$job->getId().'!';
});

$job = Resque::push('SendEmail', array(), 'email');

$job = Resque::later(60, 'MyJob', array());
$job = Resque::later(1398643990, 'MyJob', array());
$job = Resque::later(new \DateTime('+2 mins'), 'MyJob', array());
$job = Resque::later(new \DateTime('2014-07-08 11:14:15'), 'MyJob', array());

$job = Resque::push('MyJob');
$jobId = $job->getId();

$job = Resque\Job::load($jobId);
$status = $job->getStatus();

foreach(Resque\Worker::allWorkers() as $worker) {
    $worker->shutdown();
}
json
{
    "jphaynes/php-resque": "2.1.*"
    }
}

$ php composer.phar install

$ bin/resque worker:start --