PHP code example of dface / tito

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

    

dface / tito example snippets

 php

// please modify this to conform with your class-loading strategy:
$val;
	}

	function info(){
		return $_SERVER['argv'];
	}

}

// kinda container
$container = [
	'service1' => new Test('service1'),
	'service2' => new Test('service2'),
];

// Initialize tito - pass in description and service-locator callback:
$tito = new \dface\tito\Tito(
	'X-system command line tool.',
	function ($service_name) use ($container){
		return $container[$service_name];
	}
);

// ask tito to make the rest
$tito->call();

php tito.php service1 process hi
[true,"hi"]

php tito.php asd process hi
[false,"dface\\tito\\TitoException","No such service 'asd'"]