Terminal
class Terminal
Properties
| protected string|null | $initialTtyMode | The initial TTY mode. |
|
| static protected bool|null | $trueColorSupport | Whether the terminal supports true color. |
|
| static protected null|array{int, int, int} | $foregroundColor | The terminal's foreground color as an RGB array. |
|
| static protected null|array{int, int, int} | $backgroundColor | The terminal's background color as an RGB array. |
|
| protected Terminal | $terminal | The Symfony Terminal instance. |
Methods
Create a new Terminal instance.
Read a line from the terminal.
Set the TTY mode.
Restore the initial TTY mode.
Get the number of columns in the terminal.
Get the number of lines in the terminal.
(Re)initialize the terminal dimensions.
Exit the interactive session.
Execute the given command and return the output.
Execute the given command with an optional input stream.
Determine if the terminal supports true color (24-bit).
Get the terminal's foreground color as an RGB array.
Get the terminal's background color as an RGB array.
Query the terminal for foreground and background colors in a single shot.
Open the controlling terminal.
Flush all static state.
Details
at line 45
__construct()
Create a new Terminal instance.
at line 53
string
read()
Read a line from the terminal.
at line 71
void
setTty(string $mode)
Set the TTY mode.
at line 81
void
restoreTty()
Restore the initial TTY mode.
at line 93
int
cols()
Get the number of columns in the terminal.
at line 101
int
lines()
Get the number of lines in the terminal.
at line 109
void
initDimensions()
(Re)initialize the terminal dimensions.
at line 119
void
exit()
Exit the interactive session.
at line 127
protected string
exec(string $command)
Execute the given command and return the output.
at line 137
protected string
execWithInput(string $command, null|resource $input = null)
Execute the given command with an optional input stream.
at line 170
bool
supportsTrueColor()
Determine if the terminal supports true color (24-bit).
at line 180
array
foregroundColor()
Get the terminal's foreground color as an RGB array.
at line 194
array
backgroundColor()
Get the terminal's background color as an RGB array.
at line 206
protected void
queryColors()
Query the terminal for foreground and background colors in a single shot.
at line 263
protected false|resource
openTty()
Open the controlling terminal.
at line 271
static void
flushState()
Flush all static state.