PHP code example of keiii / console-service-provider
1. Go to this page and download the library: Download keiii/console-service-provider 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/ */
keiii / console-service-provider example snippets
#!/usr/bin/env php
$app = new Application();
$app->register(new ConsoleServiceProvider(), array(
'console.name' => 'MyApplication',
'console.version' => '1.0.0',
));
$console = $app['console'];
$console->add(new MyCommand());
$console->run();
$app['logger'] = $app::share(function () {
return new MyLogger(); // \Psr\Log\LoggerInterface
});
$app['console.log.listener'] = $app::share(function (Application $app) {
return new \KEIII\SilexConsole\ConsoleLogListener($app['logger']);
});
$app['dispatcher']->addSubscriber($app['console.log.listener']);