PHP code example of byjg / php-daemonize

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

    

byjg / php-daemonize example snippets



namespace Some\Name\Space;

class MyExistingClass
{
	// ...

    public function someExistingMethod()
    {
        // Your code
    }

	// ...
}



// Your code here

daemonize install --template=systemd mydaemon \
    --class "\\Some\\Name\\Space\\MyExistingClass::someExistingMethod" \
    --bootstrap "relative/path/to/bootstrap.php" \
    --rootdir "/path/to/root"

daemonize services --only-names

sudo daemonize install --template=upstart tryme "\\ByJG\\Daemon\\Sample\\TryMe::process" "vendor/autoload.php" "./"

sudo service tryme start