1. Go to this page and download the library: Download taro/chant-cli 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/ */
taro / chant-cli example snippets
namespace Taro\App\Console\Commands;
use Taro\Libs\Command\Command;
class SampleCommand extends Command
{
// ターミナル上で入力するコマンドシグネチャ
// オプション引数を [] で囲んで追加する。必須でない場合は 最後に ? を付ける
public $signature = 'command:sample_command [arg1] [arg2?]';
// パラメーター cf. ['name', 'age'] "--"は省略
public $params = [];
// フラグ cf. ['a','b','c'] "-"は省略
public $flags = [];
// コマンドの説明
public $description = 'SampleCommand Class';
// コマンド実行時の処理本体
public function handle()
{
// Here is where you write any script executed by this command
$this->textInfo('sample_command command (' . $this->signature . ')');
}
}
use Taro\App\Console\Commands\SampleCommand; <= 追加
class CommandList
{
public static $commands = [
// SomeCommand::class
ListRegisteredCommands::class,
HelpCommand::class,
MakeCommand::class,
...
SampleCommand::class, <= 追加
];
}