23 Star 90 Fork 25

inhere/php-console

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
commands.php 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
Inhere 提交于 2021-09-29 12:06 +08:00 . update some examples
<?php declare(strict_types=1);
/**
* The file is part of inhere/console
*
* @author https://github.com/inhere
* @homepage https://github.com/inhere/php-console
* @license https://github.com/inhere/php-console/blob/master/LICENSE
*/
use Inhere\Console\Application;
use Inhere\Console\BuiltIn\PharController;
use Inhere\Console\BuiltIn\SelfUpdateCommand;
use Inhere\Console\Examples\Command\CorCommand;
use Inhere\Console\Examples\Command\DemoCommand;
use Inhere\Console\Examples\Command\TestCommand;
use Inhere\Console\Examples\Controller\HomeController;
use Inhere\Console\Examples\Controller\InteractController;
use Inhere\Console\Examples\Controller\ProcessController;
use Inhere\Console\Examples\Controller\ShowController;
use Inhere\Console\IO\Input;
use Inhere\Console\IO\Output;
/** @var Application $app */
$app->command(DemoCommand::class);
$app->command('exam', function (Input $in, Output $out): void {
$cmd = $in->getCommand();
$out->info('hello, this is a test command: ' . $cmd);
}, [
'desc' => 'a description message',
]);
$app->command('test', TestCommand::class, [
'aliases' => ['t']
]);
$app->command(SelfUpdateCommand::class, null, [
'aliases' => ['selfUpdate']
]);
$app->command(CorCommand::class);
$app->controller('home', HomeController::class, [
'aliases' => ['h']
]);
$app->controller(ProcessController::class, null, [
'aliases' => 'prc'
]);
$app->controller(PharController::class);
$app->controller(ShowController::class);
$app->controller(InteractController::class);
// add alias for a group command.
$app->addAliases('home:test', 'h-test');
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/inhere/php-console.git
git@gitee.com:inhere/php-console.git
inhere
php-console
php-console
master

搜索帮助