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

__construct()

Create a new Terminal instance.

string
read()

Read a line from the terminal.

void
setTty(string $mode)

Set the TTY mode.

void
restoreTty()

Restore the initial TTY mode.

int
cols()

Get the number of columns in the terminal.

int
lines()

Get the number of lines in the terminal.

void
initDimensions()

(Re)initialize the terminal dimensions.

void
exit()

Exit the interactive session.

string
exec(string $command)

Execute the given command and return the output.

bool
supportsTrueColor()

Determine if the terminal supports true color (24-bit).

array
foregroundColor()

Get the terminal's foreground color as an RGB array.

array
backgroundColor()

Get the terminal's background color as an RGB array.

void
queryColors()

Query the terminal for foreground and background colors in a single shot.

static void
flushState()

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.

Return Value

string

at line 63
void setTty(string $mode)

Set the TTY mode.

Parameters

string $mode

Return Value

void

at line 73
void restoreTty()

Restore the initial TTY mode.

Return Value

void

at line 85
int cols()

Get the number of columns in the terminal.

Return Value

int

at line 93
int lines()

Get the number of lines in the terminal.

Return Value

int

at line 101
void initDimensions()

(Re)initialize the terminal dimensions.

Return Value

void

at line 111
void exit()

Exit the interactive session.

Return Value

void

at line 119
protected string exec(string $command)

Execute the given command and return the output.

Parameters

string $command

Return Value

string

at line 144
bool supportsTrueColor()

Determine if the terminal supports true color (24-bit).

Return Value

bool

at line 154
array foregroundColor()

Get the terminal's foreground color as an RGB array.

Return Value

array

at line 168
array backgroundColor()

Get the terminal's background color as an RGB array.

Return Value

array

at line 180
protected void queryColors()

Query the terminal for foreground and background colors in a single shot.

Return Value

void

at line 220
static void flushState()

Flush all static state.

Return Value

void