PHP code example of bastiendonjon / pid-file-manager

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

    

bastiendonjon / pid-file-manager example snippets


// Usage in simple task :
$elem = new PIDFileManager('myProcessName', storage_path());
$elem->start();

// Usage in daemon task :
$elem = new PIDFileManager('myProcessName', storage_path());
$elem->start();

// Add oneTime if you demonize your script
while(true) {
    sleep(1)
    $elem->oneTime();
}