PHP code example of mhlavac / gearman
1. Go to this page and download the library: Download mhlavac/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/ */
mhlavac / gearman example snippets
php
$client = new \MHlavac\Gearman\Client();
$client->addServer();
$result = $client->doNormal('replace', 'PHP is best programming language!');
$client->doBackground('long_task', 'PHP rules... PHP rules...');
php
$function = function($payload) {
return str_replace('java', 'php', $payload);
};
$worker = new \MHlavac\Gearman\Worker();
$worker->addServer();
$worker->addFunction('replace', $function);
$worker->work();