多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] 新建文件 `App/Command/Test.php` ``` namespace App\Command; use EasySwoole\EasySwoole\Command\CommandInterface; use EasySwoole\EasySwoole\Command\Utility; class Test implements CommandInterface { public function commandName(): string { return 'test'; } public function exec(array $args): ?string { //打印参数,打印测试值 var_dump($args); echo 'test'.PHP_EOL; return null; } public function help(array $args): ?string { //输出logo $logo = Utility::easySwooleLog(); return $logo."this is test"; } } ``` ## 新建 `/bootstrap.php` ``` \EasySwoole\EasySwoole\Command\CommandContainer::getInstance()->set(new \App\Command\Test()); ``` > bootstrap是3.2.5新增的事件,它允许用户在框架初始化之前执行自定义事件 ``` php easyswoole test php easyswoole test 123 123 php easyswoole help test ```