PHP code example of inhere / console
1. Go to this page and download the library: Download inhere/console 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/ */
inhere / console example snippets
// file: examples/app
use Inhere\Console\IO\Input;
use Inhere\Console\IO\Output;
$meta = [
'name' => 'My Console App',
'version' => '1.0.2',
];
// 通常无需传入 $input $output ,会自动创建
// $app = new \Inhere\Console\Application($meta, $input, $output);
$app = new \Inhere\Console\Application($meta);
// 注册命令
$app->command(DemoCommand::class);
// 注册命令组
$app->addGroup(MyController::class);
// ... ...
// run
$app->run();
bash
# by ENV
$ CONSOLE_DEBUG=4 php examples/app
$ CONSOLE_DEBUG=5 php examples/app
# by global options
$ php examples/app --debug 4