PHP code example of basarevych / task-daemon

1. Go to this page and download the library: Download basarevych/task-daemon 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/ */

    

basarevych / task-daemon example snippets


    'namespace' => 'TaskDaemon',                // Set to your project name
    'num_workers' => 10,                        // Number of parallel workers
    'pid_file'  => '/var/run/local-daemon.pid', // PID file path
    'debug' => false,                           // Make the daemon print debug info
    'gearman' => [                              // Gearman options
        'host' => 'localhost',
        'port' => 4730,
    ],
  
shell
Initialize:
> git clone https://github.com/basarevych/task-daemon
> cd task-daemon
> ./composer.phar install
> cd Example

Start or restart the daemon:
> php 1.start-the-daemon.php

Print 'foobar' in reverse:
> php 2.reverse-word-task.php foobar

Launch our long running task:
> php 3.infinite-task.php

Terminate:
> php 4.stop-the-daemon.php