-
-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
The example/ directory contains runnable scripts that progress from simple output to full multi-command applications.
To run any example from the project root:
php example/01-hello-world.php-
01-hello-world.phpOutputs a single message using command output helpers. -
02-greeter.phpAccepts an optional named argument and prints a personalised greeting. -
03-colour.phpDemonstrates one-off coloured output and persistent output palettes. -
04-parameters-and-flags.phpShows required named arguments, optional named arguments, required options and optional flags together. -
05-interactive.phpDemonstrates interactive input withreadLine()when optional arguments are omitted. -
06-multi-command.phpCreates a multi-command CLI withsum,repeat, and built-inhelp. -
07-repeating-lines.phpDemonstrates suppression markers for repeated consecutive output lines. -
08-progress-bar.phpShows an in-place progress bar that updates on one terminal line.
The examples are intentionally small and anonymous-class based so they can be copied directly into new scripts while keeping setup noise low.
Next, read parameters and arguments for how command contracts are defined.
PHP.GT/Cli is a separately maintained component of PHP.GT/WebEngine.