1. Go to this page and download the library: Download miknatr/net_gearman 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/ */
class Net_Gearman_Job_someBackgroundJob extends Net_Gearman_Job_Common
{
public function run($args)
{
if (!isset($args['userid']) || !isset($args['action'])) {
// Throw a Net_Gearman_Job_Exception to report back to the server that the job failed.
throw new Net_Gearman_Job_Exception('Invalid/Missing arguments');
}
// Insert a record or something based on the $args
return array(); // Results are returned to Gearman, except for
// background jobs like this one.
}
}
$worker = new Net_Gearman_Worker('localhost:7003');
$worker->addAbility('someBackgroundJob');
$worker->beginWork();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.