We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
如下,新建一个命令行入口文件。 就可以开始使用了
// file: examples/app use Inhere\Console\IO\Input; use Inhere\Console\IO\Output; $meta = [ 'name' => 'My Console App', 'version' => '1.0.2', ]; $input = new Input; $output = new Output; // 通常无需传入 $input $output ,会自动创建 $app = new \Inhere\Console\Application($meta, $input, $output); // 注册命令 $app->command('demo', function (Input $in, Output $out) { $cmd = $in->getCommand(); $out->info('hello, this is a test command: ' . $cmd); }); // ... ... // run $app->run();
然后在命令行里执行 php examples/app, 立即就可以看到如下输出了:
php examples/app
Alone Commands 中的 demo 就是我们上面添加的命令
Alone Commands
help
help COMMAND
list
version
-h, --help
--debug
--no-color
-v, --version
There was an error while loading. Please reload this page.