1. Go to this page and download the library: Download david-garcia/resque-bundle 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/ */
david-garcia / resque-bundle example snippets
php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new BCC\ResqueBundle\BCCResqueBundle(),
// ...
);
}
php
namespace My;
use BCC\ResqueBundle\Job;
class MyJob extends Job
{
public function run($args)
{
file_put_contents($args['file'], $args['content']);
}
}
php
// get resque
$resque = $this->get('bcc_resque.resque');
// create your job
$job = new MyJob();
$job->args = array(
'file' => '/tmp/file',
'content' => 'hello',
);
// enqueue your job
$resque->enqueue($job);
php
// get resque
$resque = $this->get('bcc_resque.resque');
// create your job
$job = new MyJob();
$job->args = array(
'file' => '/tmp/file',
'content' => 'hello',
);
// enqueue your job to run at a specific \DateTime or int unix timestamp
$resque->enqueueAt(\DateTime|int $at, $job);
// or
// enqueue your job to run after a number of seconds
$resque->enqueueIn($seconds, $job);
php
namespace My;
use BCC\ResqueBundle\Job;
class MyJob extends Job
{
public function __construct()
{
$this->queue = 'my_queue';
}
public function run($args)
{
...
}
}
php
// create your job
$job = new MyJob();
$job->queue = 'my_queue';
php
namespace My;
use BCC\ResqueBundle\ContainerAwareJob;
class MyJob extends ContainerAwareJob
{
public function run($args)
{
$doctrine = $this->getContainer()->getDoctrine();
...
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.