phore/cli-tools

Cli helper tools

v1.0 2020-05-01 11:12 UTC

This package is auto-updated.

Last update: 2024-10-16 09:02:20 UTC


README

Boilerplate CLI Tool

Example

The Main Command

class MainCmd extends PhoreAbstractMainCmd
{

    public function invoke(CliContext $context)
    {
        $opts = $context->getOpts("i:");

        $context->dispatchMap([
            "import" => new ImportCmd(),
            "search" => new SearchCmd()
        ], $opts);
    }
}

The Subcommand

class SearchCmd extends PhoreAbstractCmd
{

    public function invoke(CliContext $context)
    {
        $opts = $context->getOpts();
        $context->ask("Do you want to continue?");

    }
}