This adapter requires ANSICON extension to be installed. It can be obtained from:
https://github.com/adoxa/ansicon
ANSICON has to be loaded and enabled before using this adapter. It's best to install
it using following command:
ansicon -I
Console should not run in UTF8 code page (65001), because ANSICON does not behave well with it.
It's best to use non-unicode code page 437, 850, 851, 852 or similar. Run "help mode" for more
information on how to change Windows console code page.
Methods
Clear console screen
clear()
Clear line at cursor position
clearLine()
Clear console screen
clearScreen()
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::clearScreen() |
| inherited_from |
\Zend\Console\Adapter\Posix::clearScreen() |
Prepare a string that will be rendered in color.
colorize(string $string, int $color, null | int $bgColor) : string
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::colorize() |
Parameters
$string
string
$color
int
$bgColor
nullint
Exceptions
Returns
string
Determine and return current console height.
getHeight() : false | int
Return current cursor position - array($x, $y)
getPos() : array
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::getPos() |
| inherited_from |
\Zend\Console\Adapter\Posix::getPos() |
Returns
arrayarray($x, $y);
Determine and return current console width and height.
getSize() : array
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::getSize() |
| inherited_from |
\Zend\Console\Adapter\Posix::getSize() |
Returns
arrayarray($width, $height)
Return current console window title.
getTitle() : string
Determine and return current console width.
getWidth() : int
Hide console cursor
hideCursor()
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::hideCursor() |
Check if console is UTF-8 compatible
isUtf8() : bool
Read a single character from the console input
readChar(string | null $mask) : string
Parameters
$mask
stringnullA list of allowed chars
Exceptions
Returns
string
Read a single line from the console input
readLine(int $maxLength) : string
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::readLine() |
| inherited_from |
\Zend\Console\Adapter\Posix::readLine() |
Parameters
$maxLength
intMaximum response length
Returns
string
Reset color to console default.
resetColor()
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::resetColor() |
Reset console window title to previous value.
resetTitle()
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::resetTitle() |
| inherited_from |
\Zend\Console\Adapter\Posix::resetTitle() |
Change current drawing background color
setBgColor(int $bgColor)
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::setBgColor() |
Parameters
$bgColor
int
Exceptions
Set Console charset to use.
setCharset(\Zend\Console\Charset\CharsetInterface $charset)
Change current drawing color.
setColor(int $color)
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::setColor() |
Parameters
$color
int
Exceptions
Set cursor position
setPos(int $x, int $y)
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::setPos() |
Parameters
$x
int
$y
int
Set console window title
setTitle($title)
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::setTitle() |
| inherited_from |
\Zend\Console\Adapter\Posix::setTitle() |
Parameters
$title
Show console cursor
showCursor()
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::showCursor() |
Write a chunk of text to console.
write(string $text, null | int $color, null | int $bgColor)
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::write() |
| inherited_from |
\Zend\Console\Adapter\Posix::write() |
Parameters
$text
string
$color
nullint
$bgColor
nullint
Write a piece of text at the coordinates of $x and $y
writeAt(string $text, int $x, int $y, null | int $color, null | int $bgColor)
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::writeAt() |
| inherited_from |
\Zend\Console\Adapter\Posix::writeAt() |
Parameters
$text
stringText to write
$x
intConsole X coordinate (column)
$y
intConsole Y coordinate (row)
$color
nullint
$bgColor
nullint
Write a box at the specified coordinates.
writeBox(int $x1, int $y1, int $x2, int $y2, int $lineStyle, int $fillStyle, int $color, int $bgColor, null | int $fillColor, null | int $fillBgColor)
Inherited
If X or Y coordinate value is negative, it will be calculated as the distance from far right or bottom edge
of the console (respectively).
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::writeBox() |
| inherited_from |
\Zend\Console\Adapter\Posix::writeBox() |
Parameters
$x1
intTop-left corner X coordinate (column)
$y1
intTop-left corner Y coordinate (row)
$x2
intBottom-right corner X coordinate (column)
$y2
intBottom-right corner Y coordinate (row)
$lineStyle
int(optional) Box border style.
$fillStyle
int(optional) Box fill style or a single character to fill it with.
$color
int(optional) Foreground color
$bgColor
int(optional) Background color
$fillColor
nullint(optional) Foreground color of box fill
$fillBgColor
nullint(optional) Background color of box fill
Exceptions
Write a single line of text to console and advance cursor to the next line.
writeLine(string $text, null | int $color, null | int $bgColor)
Inherited
If the text is longer than console width it will be truncated.
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::writeLine() |
| inherited_from |
\Zend\Console\Adapter\Posix::writeLine() |
Parameters
$text
string
$color
nullint
$bgColor
nullint
Alias for write()
writeText(string $text, null | int $color, null | int $bgColor)
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::writeText() |
| inherited_from |
\Zend\Console\Adapter\Posix::writeText() |
Parameters
$text
string
$color
nullint
$bgColor
nullint
Write a block of text at the given coordinates, matching the supplied width and height.
writeTextBlock(string $text, int $width, int | null $height, int $x, int $y, null | int $color, null | int $bgColor)
Inherited
In case a line of text does not fit desired width, it will be wrapped to the next line.
In case the whole text does not fit in desired height, it will be truncated.
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::writeTextBlock() |
| inherited_from |
\Zend\Console\Adapter\Posix::writeTextBlock() |
Parameters
$text
stringText to write
$width
intMaximum block width. Negative value means distance from right edge.
$height
intnullMaximum block height. Negative value means distance from bottom edge.
$x
intBlock X coordinate (column)
$y
intBlock Y coordinate (row)
$color
nullint(optional) Text color
$bgColor
nullint(optional) Text background color
Get the final color code and throw exception on error
getColorCode(null | int | \Zend\Console\Color\Xterm256 $color, $type) : string
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::getColorCode() |
Parameters
$type
Exceptions
Returns
string
Helper function that return string length as rendered in console.
getStringWidth($string) : int
Inherited
| static |
|
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::getStringWidth() |
| inherited_from |
\Zend\Console\Adapter\Posix::getStringWidth() |
Parameters
$string
Returns
int
Restore TTY (Console) mode to previous value.
restoreTTYMode() : void
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::restoreTTYMode() |
Run and cache results of mode command
runModeCommand() : void
Change TTY (Console) mode
setTTYMode($mode)
Inherited
Trim a string in an encoding-safe way
stringTrim(mixed $string, mixed $length) : int
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::stringTrim() |
| inherited_from |
\Zend\Console\Adapter\Posix::stringTrim() |
Parameters
$string
mixed
$length
mixed
Returns
int
Properties
Map of colors to ANSI codes
$ansiColorMap : array
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::$$ansiColorMap |
Whether or not mbstring is enabled
$hasMBString : null | bool
Last fetched TTY mode
$lastTTYMode : string | null
Inherited
| inherited_from |
\Zend\Console\Adapter\Posix::$$lastTTYMode |
Results of mode command
$modeResult : mixed
Current cursor X position
$posX : int
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::$$posX |
| inherited_from |
\Zend\Console\Adapter\Posix::$$posX |
Current cursor Y position
$posY : int
Inherited
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::$$posY |
| inherited_from |
\Zend\Console\Adapter\Posix::$$posY |
Constants
FILL_BLOCK
FILL_BLOCK
Inherited
| inherited_from |
\Zend\Console\Adapter\AdapterInterface::FILL_BLOCK |
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::FILL_BLOCK |
| inherited_from |
\Zend\Console\Adapter\Posix::FILL_BLOCK |
FILL_NONE
FILL_NONE
Inherited
| inherited_from |
\Zend\Console\Adapter\AdapterInterface::FILL_NONE |
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::FILL_NONE |
| inherited_from |
\Zend\Console\Adapter\Posix::FILL_NONE |
FILL_SHADE_DARK
FILL_SHADE_DARK
Inherited
| inherited_from |
\Zend\Console\Adapter\AdapterInterface::FILL_SHADE_DARK |
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::FILL_SHADE_DARK |
| inherited_from |
\Zend\Console\Adapter\Posix::FILL_SHADE_DARK |
FILL_SHADE_LIGHT
FILL_SHADE_LIGHT
Inherited
| inherited_from |
\Zend\Console\Adapter\AdapterInterface::FILL_SHADE_LIGHT |
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::FILL_SHADE_LIGHT |
| inherited_from |
\Zend\Console\Adapter\Posix::FILL_SHADE_LIGHT |
FILL_SHADE_MEDIUM
FILL_SHADE_MEDIUM
Inherited
| inherited_from |
\Zend\Console\Adapter\AdapterInterface::FILL_SHADE_MEDIUM |
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::FILL_SHADE_MEDIUM |
| inherited_from |
\Zend\Console\Adapter\Posix::FILL_SHADE_MEDIUM |
LINE_BLOCK
LINE_BLOCK
Inherited
| inherited_from |
\Zend\Console\Adapter\AdapterInterface::LINE_BLOCK |
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::LINE_BLOCK |
| inherited_from |
\Zend\Console\Adapter\Posix::LINE_BLOCK |
LINE_DOUBLE
LINE_DOUBLE
Inherited
| inherited_from |
\Zend\Console\Adapter\AdapterInterface::LINE_DOUBLE |
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::LINE_DOUBLE |
| inherited_from |
\Zend\Console\Adapter\Posix::LINE_DOUBLE |
LINE_NONE
LINE_NONE
Inherited
| inherited_from |
\Zend\Console\Adapter\AdapterInterface::LINE_NONE |
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::LINE_NONE |
| inherited_from |
\Zend\Console\Adapter\Posix::LINE_NONE |
LINE_SINGLE
LINE_SINGLE
Inherited
| inherited_from |
\Zend\Console\Adapter\AdapterInterface::LINE_SINGLE |
| inherited_from |
\Zend\Console\Adapter\AbstractAdapter::LINE_SINGLE |
| inherited_from |
\Zend\Console\Adapter\Posix::LINE_SINGLE |