InteractsWithIO
trait InteractsWithIO
Properties
| protected Factory|null | $components | The console components factory. |
|
| protected InputInterface|null | $input | The input interface implementation. |
|
| protected OutputStyle|null | $output | The output interface implementation. |
|
| protected int | $verbosity | The default verbosity of output commands. |
|
| protected array<string, int> | $verbosityMap | The mapping between human-readable verbosity levels and Symfony's OutputInterface. |
Methods
Retrieve the command's input as a CommandInput instance or retrieve an input item.
Determine whether the argument is defined in the command signature.
Get the value of a command argument.
Get all of the arguments passed to the command.
Determine whether the option is defined in the command signature.
Get the value of a command option.
Get all of the options passed to the command.
Confirm a question with the user.
Prompt the user for input.
Prompt the user for input with auto completion.
Prompt the user for input with auto completion.
Prompt the user for input but hide the answer from the console.
Give the user a single choice from an array of answers.
Execute a given callback while advancing a progress bar.
Write a string as information output.
Write a string as standard output.
Write a string as comment output.
Write a string as question output.
Write a string as error output.
Write a string as warning output.
Write a string in an alert box.
Write a blank line.
Set the input interface implementation.
Get the output implementation.
Get the output component factory implementation.
Set the verbosity level.
Get the verbosity level in terms of Symfony's OutputInterface level.
Details
at line 63
mixed
input(string|null $key = null, mixed $default = null)
Retrieve the command's input as a CommandInput instance or retrieve an input item.
at line 73
bool
hasArgument(int|string $name)
Determine whether the argument is defined in the command signature.
at line 83
mixed
argument(string|null $key = null)
Get the value of a command argument.
at line 95
array
arguments()
Get all of the arguments passed to the command.
at line 103
bool
hasOption(string $name)
Determine whether the option is defined in the command signature.
at line 113
mixed
option(string|null $key = null)
Get the value of a command option.
at line 125
array
options()
Get all of the options passed to the command.
at line 133
bool
confirm(string $question, bool $default = false)
Confirm a question with the user.
at line 141
mixed
ask(string $question, string|null $default = null)
Prompt the user for input.
at line 151
mixed
anticipate(string $question, iterable|callable $choices, string|null $default = null)
Prompt the user for input with auto completion.
at line 161
mixed
askWithCompletion(string $question, iterable|callable $choices, string|null $default = null)
Prompt the user for input with auto completion.
at line 175
mixed
secret(string $question, bool $fallback = true)
Prompt the user for input but hide the answer from the console.
at line 190
array|string
choice(string $question, array $choices, int|string|null $default = null, int|null $attempts = null, bool $multiple = false)
Give the user a single choice from an array of answers.
at line 204
void
table(array $headers, array|Arrayable $rows, string|TableStyle $tableStyle = 'default', array $columnStyles = [])
Format input to textual table.
at line 232
mixed
withProgressBar(iterable|int $totalSteps, Closure $callback)
Execute a given callback while advancing a progress bar.
at line 262
void
info(string $string, int|string|null $verbosity = null)
Write a string as information output.
at line 270
void
line(string $string, string|null $style = null, int|string|null $verbosity = null)
Write a string as standard output.
at line 280
void
comment(string $string, int|string|null $verbosity = null)
Write a string as comment output.
at line 288
void
question(string $string, int|string|null $verbosity = null)
Write a string as question output.
at line 296
void
error(string $string, int|string|null $verbosity = null)
Write a string as error output.
at line 304
void
warn(string $string, int|string|null $verbosity = null)
Write a string as warning output.
at line 318
void
alert(string $string, int|string|null $verbosity = null)
Write a string in an alert box.
at line 332
InteractsWithIO
newLine(int $count = 1)
Write a blank line.
at line 342
void
setInput(InputInterface $input)
Set the input interface implementation.
at line 350
void
setOutput(OutputStyle $output)
Set the output interface implementation.
at line 358
OutputStyle|null
getOutput()
Get the output implementation.
at line 366
Factory|null
outputComponents()
Get the output component factory implementation.
at line 374
protected void
setVerbosity(int|string $level)
Set the verbosity level.
at line 382
protected int
parseVerbosity(int|string|null $level = null)
Get the verbosity level in terms of Symfony's OutputInterface level.