Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,31 @@
Webisters CLI Library This library is designed for reuse in Composer-based PHP applications.

## What It Provides
- Command-line friendly workflows for local automation and maintenance tasks.
- Reusable PHP components intended for integration into larger applications.
- Clean interfaces and extension points to support maintainable implementations.

A lightweight PHP library for building command line applications. It has three core components:

### `Framework\CLI\CLI`
A static toolkit for terminal output and input:
- `write()`, `style()`, `success()`, `info()`, `error()`, `box()`, `newLine()` for formatted output with optional `Framework\CLI\Styles\ForegroundColor`, `BackgroundColor` and `Format` styling
- `progress()`, `spinner()`, `liveLine()` for live terminal feedback
- `prompt()`, `getInput()`, `secret()` for reading user input
- `table()` for rendering tabular data
- `getWidth()`, `wrap()`, `strlen()`, `clear()`, `beep()` and terminal helpers
- ANSI control with `setAnsi()` and quiet mode with `setQuiet()`
- Signal handling with `onSignal()`, `onSigint()` and `restoreSignal()` when pcntl is available

### `Framework\CLI\Command`
The abstract base class for every console command. Extend it and implement `run()`:
- `$name`, `getDescription()`, `setGroup()`, `setUsage()` and `setAliases()` describe the command and its help output
- `getOptions()` defines the options a command accepts
- `activate()` / `deactivate()` control availability

### `Framework\CLI\Console`
Discovers, registers and runs commands:
- `addCommand()` / `addCommands()` accept Command instances or class names
- `run()` parses argv, matches the requested command (including aliases) and dispatches to `exec()`
- Unknown commands fall back to `Index` (which lists available commands) and suggest the closest matching command name
- `getArgument()`, `getArguments()`, `getOption()` and `getOptions()` expose the parsed command line

## Installation
```bash
Expand Down
Loading