Fully Qualified Name: | Zend\Console\Adapter\WindowsAnsicon |
Extends: | Posix |
MS Windows with ANSICON console adapter
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.
Name | Description | Defined By |
---|---|---|
clear() | Clear console screen | WindowsAnsicon |
clearLine() | Clear line at cursor position | WindowsAnsicon |
clearScreen() | Clear console screen | AbstractAdapter |
colorize() | Prepare a string that will be rendered in color. | Posix |
encodeText() | Encode a text to match console encoding | AbstractAdapter |
getCharset() | Get charset currently in use by this adapter. | WindowsAnsicon |
getDefaultCharset() | WindowsAnsicon | |
getHeight() | Determine and return current console height. | WindowsAnsicon |
getSize() | Determine and return current console width and height. | AbstractAdapter |
getTitle() | Return current console window title. | WindowsAnsicon |
getWidth() | Determine and return current console width. | WindowsAnsicon |
hideCursor() | Hide console cursor | Posix |
isUtf8() | Check if console is UTF-8 compatible | WindowsAnsicon |
readChar() | Read a single character from the console input | WindowsAnsicon |
readLine() | Read a single line from the console input | AbstractAdapter |
resetColor() | Reset color to console default. | Posix |
setBgColor() | Change current drawing background color | Posix |
setCharset() | Set Console charset to use. | WindowsAnsicon |
setColor() | Change current drawing color. | Posix |
setPos() | Set cursor position | Posix |
showCursor() | Show console cursor | Posix |
write() | Write a chunk of text to console. | AbstractAdapter |
writeAt() | Write a piece of text at the coordinates of $x and $y | AbstractAdapter |
writeBox() | Write a box at the specified coordinates. | AbstractAdapter |
writeLine() | Write a single line of text to console and advance cursor to the next line. | Posix |
writeText() | Alias for write() | AbstractAdapter |
writeTextBlock() | Write a block of text at the given coordinates, matching the supplied width and height. | AbstractAdapter |
Clear console screen
Returns:
Clear line at cursor position
Returns:
Clear console screen
Returns:
Prepare a string that will be rendered in color.
Parameter Name | Type | Description |
---|---|---|
$string | string | |
$color | int | |
$bgColor | null|int |
Returns: string
Encode a text to match console encoding
Parameter Name | Type | Description |
---|---|---|
$text | string |
Returns: string the encoding text
Get charset currently in use by this adapter.
Returns: \CharsetInterface $charset
Returns: \Charset\AsciiExtended
Determine and return current console height.
Returns: bool|int
Determine and return current console width and height.
Returns: int[] array($width, $height)
Return current console window title.
Returns: string
Determine and return current console width.
Returns: int
Hide console cursor
Returns:
Check if console is UTF-8 compatible
Returns: bool
Read a single character from the console input
Parameter Name | Type | Description |
---|---|---|
$mask | string|null | A |
Returns: string
Read a single line from the console input
Parameter Name | Type | Description |
---|---|---|
$maxLength | int | Maximum |
Returns: string
Reset color to console default.
Returns:
Change current drawing background color
Parameter Name | Type | Description |
---|---|---|
$bgColor | int |
Returns:
Set Console charset to use.
Parameter Name | Type | Description |
---|---|---|
$charset | \CharsetInterface |
Returns:
Change current drawing color.
Parameter Name | Type | Description |
---|---|---|
$color | int |
Returns:
Set cursor position
Parameter Name | Type | Description |
---|---|---|
$x | int | |
$y | int |
Returns:
Show console cursor
Returns:
Write a chunk of text to console.
Parameter Name | Type | Description |
---|---|---|
$text | string | |
$color | null|int | |
$bgColor | null|int |
Returns:
Write a piece of text at the coordinates of $x and $y
Parameter Name | Type | Description |
---|---|---|
$text | string | Text |
$x | int | Console |
$y | int | Console |
$color | null|int | |
$bgColor | null|int |
Returns:
Write a box at the specified coordinates.
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).
Parameter Name | Type | Description |
---|---|---|
$x1 | int | Top-left |
$y1 | int | Top-left |
$x2 | int | Bottom-right |
$y2 | int | Bottom-right |
$lineStyle | int | (optional) |
$fillStyle | int | (optional) |
$color | int | (optional) |
$bgColor | int | (optional) |
$fillColor | null|int | (optional) |
$fillBgColor | null|int | (optional) |
Returns:
Write a single line of text to console and advance cursor to the next line.
This override works around a bug in some terminals that cause the background color to fill the next line after EOL. To remedy this, we are sending the colored string with appropriate color reset sequences before sending EOL character.
Parameter Name | Type | Description |
---|---|---|
$text | string | |
$color | null|int | |
$bgColor | null|int |
Returns:
Alias for write()
Parameter Name | Type | Description |
---|---|---|
$text | string | |
$color | null|int | |
$bgColor | null|int |
Returns:
Write a block of text at the given coordinates, matching the supplied width and height.
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.
Parameter Name | Type | Description |
---|---|---|
$text | string | Text |
$width | int | Maximum |
$height | int|null | Maximum |
$x | int | Block |
$y | int | Block |
$color | null|int | (optional) |
$bgColor | null|int | (optional) |
Returns: