PHP code example of ustream / daemon

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

    

ustream / daemon example snippets




$runner = new Ustream_Daemon_Runner();

$runner->runDaemon(
	__DIR__ . '/run', // run directory, pids are stored here
	'production',     // context it is used to suffix log filenames and pidfiles
	__DIR__ . '/ini', // ini directory, the configuration files are stored here
	array()           // event listeners
);

$daemon->addListeners(array(
			Ustream_Daemon_Event::START => array(
				array($onStartListener, 'onStart'),
			),
			Ustream_Daemon_Event::TASK_DONE => array(
				array($onTaskDoneListener, 'onTaskDone'),
			)
		);