Shell
チュートリアルを参照した。
コンソールツール、シェルとタスク - 3.x
src/Shell直下にHelloShell.phpを作る。
<?php namespace App\Shell; use Cake\Console\Shell; class HelloShell extends Shell { public function main() { $this->out('Hello world.'); } public function heyThere($name = 'Anonymous') { $this->out('Hey there ' . $name); $this->_hoge(); } // _が先頭にあるものは呼べない。 public function _hoge() { $this->out('hoge'); } } ?>
実行は
./bin/cake hello
や
./bin/cake Hello hey_there name
等でできる。
bakeもできる。
./bin/cake bake shell User