Download the PHP package fyre/console without Composer
On this page you can find all versions of the php package fyre/console. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package console
FyreConsole
FyreConsole is a free, open-source CLI library for PHP.
Table Of Contents
- Installation
- Basic Usage
- Methods
- Static Methods
- Colors
- Styles
Installation
Using Composer
In PHP:
Basic Usage
$input
is the input stream, and will default toSTDIN
(ornull
for non-CLI usage).$output
is the output stream, and will default toSTDOUT
(or "php://output" for non-CLI usage).$error
is the error stream, and will default toSTDERR
(or "php://output" for non-CLI usage).
Methods
Choice
Prompt to make a choice out of available options.
$text
is a string representing the prompt text.$options
is an array containing the options.$default
is a string representing the default option, and will default to null.
Comment
Output comment text.
$text
is a string representing the text.$options
is an array containing the color options.color
is a number representing the text color, and will default to null.bg
is a number representing the background color, and will default to null.style
is a number indicating the text style, and will default toConsole::DIM
.
Confirm
Prompt to confirm with y/n options.
$text
is a string representing the prompt text.$default
is a boolean representing the default option, and will default to true.
Error
Output text to STDERR.
$text
is a string representing the text.$options
is an array containing the color options.color
is a number representing the text color, and will default toConsole::RED
.bg
is a number representing the background color, and will default to null.style
is a number indicating the text style, and will default to null.
Info
Output info text.
$text
is a string representing the text.$options
is an array containing the color options.color
is a number representing the text color, and will default toConsole::BLUE
.bg
is a number representing the background color, and will default to null.style
is a number indicating the text style, and will default to null.
Input
Read a line of input.
Progress
Output a progress indicator.
$step
is a number representing the current step, and will default to null.$totalSteps
is a number representing the total steps, and will default to 10.
Sequential calls to this method will update the progress indicator. If the $step
is set to null the indicator will be cleared.
Prompt
Prompt the user for input.
$text
is a string representing the prompt text.
Success
Output success text.
$text
is a string representing the text.$options
is an array containing the color options.color
is a number representing the text color, and will default toConsole::GREEN
.bg
is a number representing the background color, and will default to null.style
is a number indicating the text style, and will default to null.
Table
Output a table.
$data
is an array containing the table rows.$header
is an array containing the table header columns, and will default to [].
Warning
Output warning text.
$text
is a string representing the text.$options
is an array containing the color options.color
is a number representing the text color, and will default toConsole::YELLOW
.bg
is a number representing the background color, and will default to null.style
is a number indicating the text style, and will default to null.
Write
Output text to STDOUT.
$text
is a string representing the text.$options
is an array containing the color options.color
is a number representing the text color, and will default toConsole::YELLOW
.bg
is a number representing the background color, and will default to null.style
is a number indicating the text style, and will default to null.
Static Methods
Get Height
Get the terminal height (in characters).
Get Width
Get the terminal width (in characters).
Style
Style text for terminal output.
$text
is a string representing the text.$options
is an array containing the color options.color
is a number representing the text color, and will default to null.bg
is a number representing the background color, and will default to null.style
is a number indicating the text style, and will default to null.
Wrap
Wrap text for terminal output.
$text
is a string representing the text.$maxWidth
is a number representing the maximum character width of a line, and will default to the terminal width.