PHP code example of viloveul / console
1. Go to this page and download the library: Download viloveul/console 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/ */
viloveul / console example snippets
class MyCommand extends Viloveul\Console\Command
{
public function handle()
{
$this->writeNormal('Hello World');
$this->writeInfo('Hello World');
$this->writeError('Hello World');
$this->writeQuestion('Hello World');
$this->writeComment('Hello World');
}
}
$console = new Viloveul\Console\Console();
$console->boot();
// add command
$cmd = new MyCommand("hello");
$console->add($cmd);
// run
$console->run();
bash
$ php your-file hello