1. Go to this page and download the library: Download softwarepunt/php-resque 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/ */
softwarepunt / php-resque example snippets
Resque::setBackend('localhost:6379');
namespace MyApp;
class Greeter_Job
{
public function setUp()
{
// Optional: Set up before (called before perform())
}
public function perform()
{
// Required: Main work method
// Perform work; context data is accessible from $this->args
echo "Hello, {$this->args['name']}!";
}
public function tearDown()
{
// Optional: Tear down after (called after job finishes)
}
}
// Enqueue an instance of "My_Job" in the "default" queue
Resque::enqueue('default', 'MyApp\Greeter_Job', ['name' => "Hank"]);
// Remove all jobs of a certain type from a queue
Resque::dequeue('default', ['MyApp\Greeter_Job']);
// Remove specific job from a queue
Resque::dequeue('default', ['MyApp\Greeter_Job' => '087df5819a790ac666c9608e2234b21e']);