PHP code example of yusukezzz / consolet

1. Go to this page and download the library: Download yusukezzz/consolet 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/ */

    

yusukezzz / consolet example snippets


$console = \Consolet\Application::start();
$exit_cd = $console->run();

 // cmd.php
nd extends \Consolet\Command
{
    // this command name is hello (auto set by Class name)
    // if you want to change it, edit $name property
    //protected $name = 'hey';
    public function fire()
    {
        $this->line('Hello World!');
    }
}
$console = \Consolet\Application::start();
$console->add(new HelloCommand);
exit($console->run());

 // cmd.php
d extends \Consolet\Command
{
    public function fire()
    {
        $this->line($this->container['hoge']);
    }
}
$console = \Consolet\Application::start(['hoge' => 'huga']);
// or \Consolet\Application::start(new \Pimple(['hoge' => 'huga']));
$console->add(new HogeCommand);
exit($console->run());