PHP code example of kael-shipman / php-executables

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

    

kael-shipman / php-executables example snippets



namespace KS;

// src/bootstrap-cli.php

$root = __DIR__;
)
        ->aka('config-file')
        ->describedAs("The path defining the daemon's config file");

    // Get a config file path, or use default
    if (!$cmd['c']) {
        if (!($home = getenv("HOME"))) {
            $home = "/root";
        }
        $defaultOverride = true;
        $configFile = "$home/.config/ks/exchange-daemon.conf";
    } else {
        $defaultOverride = false;
        $configFile = realpath($cmd['c']);
    }

    // See notes on configuration below
    $config = 


namespace KS;

// src/MyExec.php

class MyExec extends AbstractExecutable
{
    public function run(array $config = [])
    {
        $this->checkConfig($config);

        do {
            // Run application
        } while (true)
    }

    protected function checkConfig(array $config)
    {
        // Do configuration checks here
    }
}



// Static, default config
$config = $globalConfig = '/etc/my-exec/config';
if (!file_exists($globalConfig)) {
    throw new \RuntimeException("You must provide a global configuration file at `$globalConfig`");
}
$config = array_replace_recursive($config, lConfig.d/$f";
    }
}
sort($userConfig);
foreach($userConfig as $c) {
    $config = array_replace_recursive($config,