Kleine CLI-Dispatcher-Library für PHP.
<?php
require __DIR__ . "/vendor/autoload.php";
use Phore\Cli\CliDispatcher;
use Phore\Cli\Annotation\CliParameter;
class App
{
public function greet(
#[CliParameter("name", "Name der Person")]
string $name
): void {
echo "Hallo {$name}!\n";
}
}
CliDispatcher::addClass(App::class);
CliDispatcher::run($argv);Aufruf:
php app.php app greet --name Matthiasexamples/creating-actions.php– Actions mitCliDispatcherundCliParameterexamples/helper-in.php– Eingaben mitPhore\Cli\Input\Inexamples/helper-out.php– formatierte Ausgabe mitPhore\Cli\Output\Outexamples/helper-nc.php– einfache TUI-Helfer mitPhore\Cli\Ncurses\Ncexamples/helper-clipreset.php– Presets mitPhore\Cli\CliPreset
Phore\Cli\CliDispatcher– registriert Command-Gruppen und startet das DispatchingPhore\Cli\Annotation\CliParameter– beschreibt CLI-ParameterPhore\Cli\Input\In– interaktive EingabenPhore\Cli\Output\Out– Text- und Tabellen-AusgabePhore\Cli\CliPreset– lädt Presets auscli_presets.iniPhore\Cli\Ncurses\Nc– einfache terminalbasierte Form-/Tabellen-Helfer
Weitere Übersicht: .ai-usage-info.md