PHP code example of kanfa / runner

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

    

kanfa / runner example snippets

sh
$parameters = [];
$parameters['callback'] = function () {
    echo 'Function Body';
};
$runner = new \Runner\Engine\Runner($parameters);
$runner->run();
sh
$parameters = [];
$parameters['callback'] = function ($foo) {
    echo 'Function Body';
};
$parameters['params'] = ['foo']
sh
$runner = new \Runner\Engine\Runner();
$runner->run($params);
sh
 $runner =  Runner\Engine\Runner::createForm(new Class\To\Inject());
 
sh
 $runner =  Runner\Engine\Runner::create('path/to/ini_or_php/file', new Class\To\Inject());
 
sh
$parameters = [];
$parameters['class'] = '\ClassNamespace\FakeClass'
$parameters['action']) = 'find';
$parameters['params'] = ['id']



namespace ClassNamespace
class FakeClass
{
    public function find($id)
    {
        echo "I found the element matching Id : $id"
    }
}

sh
$runner = new \Runner\Engine\Runner(path/to/ini_or_php/file);
sh
$runner = \Runner\Engine\Runner::create(path/to/ini_or_php/file);
sh
$runner = \Runner\Engine\Runner::singleton(path/to/ini_or_php/file);
sh


return [
    'default_r' => '\Custom\DefaultsRunner\FakeClass'
    'callback_r' => '\Custom\CallbackRunner\FakeClass'
];