Heratio Framework API Reference

BaseCommand
in package

AbstractYes

Base class for all AtoM Heratio CLI commands.

Provides argument/option parsing, output helpers, and database access. Subclasses implement handle() and optionally override configure().

Usage: class MyCommand extends BaseCommand { protected string $name = 'tools:my-command'; protected string $description = 'Does something useful';

  protected function configure(): void {
      $this->addArgument('name', 'The name to use', true);
      $this->addOption('verbose', 'v', 'Show detailed output');
      $this->addOption('limit', 'l', 'Max records', '100');
  }

  protected function handle(): int {
      $name = $this->argument('name');
      $limit = (int) $this->option('limit');
      $this->info("Processing {$name} with limit {$limit}");
      return 0;
  }

}

Table of Contents

Methods

__construct()  : mixed
getDescription()  : string
Get the command description.
getName()  : string
Get the command name.
getNamespace()  : string
Get the namespace portion of the command name.
run()  : int
Run the command (called by the CLI router).

Methods

__construct()

public __construct([array<string|int, mixed> $argv = [] ]) : mixed
Parameters
$argv : array<string|int, mixed> = []

getDescription()

Get the command description.

public getDescription() : string
Return values
string

getName()

Get the command name.

public getName() : string
Return values
string

getNamespace()

Get the namespace portion of the command name.

public getNamespace() : string
Return values
string

run()

Run the command (called by the CLI router).

public run() : int
Return values
int

        
On this page

Search results