1. Go to this page and download the library: Download kohkimakimoto/workerphp 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/ */
kohkimakimoto / workerphp example snippets
ker = new \Kohkimakimoto\Worker\Worker();
// job for every minute.
$worker->job("hello", ['cron_time' => '* * * * *', 'command' => function(){
echo "Hello world\n";
}]);
// job runs a shell command.
$worker->job("uptime", ['cron_time' => '10 * * * *', 'command' => "uptime"]);
$worker->start();
$worker = new \Kohkimakimoto\Worker\Worker();
$worker->httpServer->listen();
// ...
$worker->start();
$worker->httpServer->listen(8888, 'localhost');
$ php worker.php
Starting WorkerPHP.
Successfully booted. Quit working with CONTROL-C.
$ php worker.php
...
Runs job: hello (pid: 90621) at 2014-12-16 08:03:00
Hello world
Skip the job 'hello' due to limit of max processes: 1 at 2014-12-16 08:04:00
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.