viloveul/console

基于 Symfony Console 的 Viloveul 控制台应用程序

v1.0.4 2019-05-29 20:09 UTC

This package is auto-updated.

Last update: 2024-09-09 05:25:22 UTC


README

确保您的 PHP 版本 > 7.0

composer require viloveul/console

如何

require __DIR__ . '/vendor/autoload.php';

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();

然后

$ php your-file hello