Output
Output
Console output helper with formatter integration.
class OutputApplies style markup formatting to outgoing messages and writes the final rendered text to standard output.
Properties
formatter
Message formatter used to render console style tags.
private OutputFormatter $formatterType: Hazaar\Console\Formatter\OutputFormatter
Methods
__construct
Creates an output writer with the default formatter implementation.
public __construct(): voidwrite
Writes a formatted message to standard output.
public write(string $message): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | message containing optional formatter markup |
writeln
Writes a formatted message to standard output followed by a newline.
public writeln(string $message): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | message containing optional formatter markup |
prompt
Prompts the user for input, optionally hiding typed characters for secrets.
public prompt(string $label, ?string $default, bool $secret): stringReturns: string
Writes the label (and optional default in brackets) to standard output, then reads a single line from STDIN. When $secret is true, terminal echo is suppressed while the user types and a * is rendered for each character.
Parameters
| Parameter | Type | Description |
|---|---|---|
$label | string | prompt text shown to the user |
$default | string | default value shown in brackets; returned when the user submits empty input |
$secret | bool | when true the terminal echo is suppressed while the user types |
readSecretInput
Reads hidden input from STDIN and masks typed characters with asterisks.
private readSecretInput(): stringReturns: string
Backspace is supported in interactive terminals.
close
Closes the output stream and resets any applied text formatting styles.
public close(): voidReturns: void
This method outputs a reset sequence to clear any foreground and background color formatting that may have been applied during console output.
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:18 +0000