helpers\Console

All Classes | Methods | Constants
Inheritance yii\helpers\Console ยป yii\helpers\BaseConsole
Available since version 2.0
Source Code https://github.com/yiisoft/yii2/blob/master/framework/helpers/Console.php

Console helper provides useful methods for command line related tasks such as getting input or formatting and coloring output.

Public Methods

Method Description Defined By
ansiFormat() Will return a string formatted with the given ANSI style yii\helpers\BaseConsole
ansiFormatCode() Returns the ANSI format code. yii\helpers\BaseConsole
ansiStrlen() Returns the length of the string without ANSI color codes. yii\helpers\BaseConsole
ansiToHtml() Converts an ANSI formatted string to HTML yii\helpers\BaseConsole
beginAnsiFormat() Echoes an ANSI format code that affects the formatting of any text that is printed afterwards. yii\helpers\BaseConsole
clearLine() Clears the line, the cursor is currently on by sending ANSI control code EL with argument 2 to the terminal. yii\helpers\BaseConsole
clearLineAfterCursor() Clears text from cursor position to the end of the line by sending ANSI control code EL with argument 0 to the terminal. yii\helpers\BaseConsole
clearLineBeforeCursor() Clears text from cursor position to the beginning of the line by sending ANSI control code EL with argument 1 to the terminal. yii\helpers\BaseConsole
clearScreen() Clears entire screen content by sending ANSI control code ED with argument 2 to the terminal. yii\helpers\BaseConsole
clearScreenAfterCursor() Clears text from cursor to the end of the screen by sending ANSI control code ED with argument 0 to the terminal. yii\helpers\BaseConsole
clearScreenBeforeCursor() Clears text from cursor to the beginning of the screen by sending ANSI control code ED with argument 1 to the terminal. yii\helpers\BaseConsole
confirm() Asks user to confirm by typing y or n. yii\helpers\BaseConsole
endAnsiFormat() Resets any ANSI format set by previous method beginAnsiFormat() Any output after this will have default text format. yii\helpers\BaseConsole
endProgress() Ends a progress bar that has been started by startProgress(). yii\helpers\BaseConsole
error() Prints text to STDERR appended with a carriage return (PHP_EOL). yii\helpers\BaseConsole
escape() Escapes % so they don't get interpreted as color codes when the string is parsed by renderColoredString() yii\helpers\BaseConsole
getScreenSize() Usage: list($width, $height) = ConsoleHelper::getScreenSize(); yii\helpers\BaseConsole
hideCursor() Hides the cursor by sending ANSI DECTCEM code ?25l to the terminal. yii\helpers\BaseConsole
input() Asks the user for input. Ends when the user types a carriage return (PHP_EOL). Optionally, It also provides a prompt. yii\helpers\BaseConsole
isRunningOnWindows() Returns true if the console is running on windows yii\helpers\BaseConsole
markdownToAnsi() Converts Markdown to be better readable in console environments by applying some ANSI format yii\helpers\BaseConsole
moveCursorBackward() Moves the terminal cursor backward by sending ANSI control code CUB to the terminal. yii\helpers\BaseConsole
moveCursorDown() Moves the terminal cursor down by sending ANSI control code CUD to the terminal. yii\helpers\BaseConsole
moveCursorForward() Moves the terminal cursor forward by sending ANSI control code CUF to the terminal. yii\helpers\BaseConsole
moveCursorNextLine() Moves the terminal cursor to the beginning of the next line by sending ANSI control code CNL to the terminal. yii\helpers\BaseConsole
moveCursorPrevLine() Moves the terminal cursor to the beginning of the previous line by sending ANSI control code CPL to the terminal. yii\helpers\BaseConsole
moveCursorTo() Moves the cursor to an absolute position given as column and row by sending ANSI control code CUP or CHA to the terminal. yii\helpers\BaseConsole
moveCursorUp() Moves the terminal cursor up by sending ANSI control code CUU to the terminal. yii\helpers\BaseConsole
output() Prints text to STDOUT appended with a carriage return (PHP_EOL). yii\helpers\BaseConsole
prompt() Prompts the user for input and validates it yii\helpers\BaseConsole
renderColoredString() Converts a string to ansi formatted by replacing patterns like %y (for yellow) with ansi control codes yii\helpers\BaseConsole
restoreCursorPosition() Restores the cursor position saved with saveCursorPosition() by sending ANSI control code RCP to the terminal. yii\helpers\BaseConsole
saveCursorPosition() Saves the current cursor position by sending ANSI control code SCP to the terminal. yii\helpers\BaseConsole
scrollDown() Scrolls whole page down by sending ANSI control code SD to the terminal. yii\helpers\BaseConsole
scrollUp() Scrolls whole page up by sending ANSI control code SU to the terminal. yii\helpers\BaseConsole
select() Gives the user an option to choose from. Giving '?' as an input will show a list of options to choose from and their explanations. yii\helpers\BaseConsole
showCursor() Will show a cursor again when it has been hidden by hideCursor() by sending ANSI DECTCEM code ?25h to the terminal. yii\helpers\BaseConsole
startProgress() Starts display of a progress bar on screen. yii\helpers\BaseConsole
stderr() Prints a string to STDERR. yii\helpers\BaseConsole
stdin() Gets input from STDIN and returns a string right-trimmed for EOLs. yii\helpers\BaseConsole
stdout() Prints a string to STDOUT. yii\helpers\BaseConsole
streamSupportsAnsiColors() Returns true if the stream supports colorization. ANSI colors are disabled if not supported by the stream. yii\helpers\BaseConsole
stripAnsiFormat() Strips ANSI control codes from a string yii\helpers\BaseConsole
updateProgress() Updates a progress bar that has been started by startProgress(). yii\helpers\BaseConsole
wrapText() Word wrap text with indentation to fit the screen size yii\helpers\BaseConsole
xtermBgColor() Returns the ansi format code for xterm background color. yii\helpers\BaseConsole
xtermFgColor() Returns the ansi format code for xterm foreground color. yii\helpers\BaseConsole

Constants

Constant Value Description Defined By
BG_BLACK 40 yii\helpers\BaseConsole
BG_BLUE 44 yii\helpers\BaseConsole
BG_CYAN 46 yii\helpers\BaseConsole
BG_GREEN 42 yii\helpers\BaseConsole
BG_GREY 47 yii\helpers\BaseConsole
BG_PURPLE 45 yii\helpers\BaseConsole
BG_RED 41 yii\helpers\BaseConsole
BG_YELLOW 43 yii\helpers\BaseConsole
BLINK 5 yii\helpers\BaseConsole
BOLD 1 yii\helpers\BaseConsole
CONCEALED 8 yii\helpers\BaseConsole
CROSSED_OUT 9 yii\helpers\BaseConsole
ENCIRCLED 52 yii\helpers\BaseConsole
FG_BLACK 30 yii\helpers\BaseConsole
FG_BLUE 34 yii\helpers\BaseConsole
FG_CYAN 36 yii\helpers\BaseConsole
FG_GREEN 32 yii\helpers\BaseConsole
FG_GREY 37 yii\helpers\BaseConsole
FG_PURPLE 35 yii\helpers\BaseConsole
FG_RED 31 yii\helpers\BaseConsole
FG_YELLOW 33 yii\helpers\BaseConsole
FRAMED 51 yii\helpers\BaseConsole
ITALIC 3 yii\helpers\BaseConsole
NEGATIVE 7 yii\helpers\BaseConsole
NORMAL 0 yii\helpers\BaseConsole
OVERLINED 53 yii\helpers\BaseConsole
RESET 0 yii\helpers\BaseConsole
UNDERLINE 4 yii\helpers\BaseConsole
doc_Yii
2016-10-30 17:05:38
Comments
Leave a Comment

Please login to continue.