1. Go to this page and download the library: Download instasent/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/ */
instasent / resque-bundle example snippets
php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Instasent\ResqueBundle\InstasentResqueBundle(),
// ...
);
}
php
namespace My;
use Instasent\ResqueBundle\Job;
class MyJob extends Job
{
public function run($args)
{
\file_put_contents($args['file'], $args['content']);
}
}
php
// get resque
$resque = $this->get('instasent_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('instasent_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 Instasent\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 Instasent\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.