Command
class Command extends Command
Traits
Properties
| protected Factory|null | $components | The console components factory. |
from InteractsWithIO |
| protected InputInterface|null | $input | from InteractsWithIO | |
| protected OutputStyle|null | $output | from InteractsWithIO | |
| protected int | $verbosity | The default verbosity of output commands. |
from InteractsWithIO |
| protected array | $verbosityMap | The mapping between human readable verbosity levels and Symfony's OutputInterface. |
from InteractsWithIO |
| protected SignalRegistry|null | $signalRegistry | from InteractsWithSignals | |
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected string|null | $signature | The name and signature of the console command. |
|
| protected string|null | $name | The console command name. |
|
| protected string | $description | The console command description. |
|
| protected string | $help | The console command help text. |
|
| $hidden | Indicates whether the command should be shown in the Artisan command list. |
||
| protected bool | $isolated | Indicates whether only one instance of the command can run at any given time. |
|
| protected int | $isolatedExitCode | The default exit code for isolated commands. |
|
| protected string[] | $aliases | The console command name aliases. |
|
| protected bool | $coroutine | Whether to execute in a coroutine environment. |
|
| protected Dispatcher|null | $eventDispatcher | The event dispatcher instance. |
|
| protected int | $hookFlags | The hook flags for the coroutine. |
|
| protected int | $exitCode | The exit code of the command. |
|
| protected Application|null | $hypervel | The Hypervel application instance. |
Methods
Resolve the console command instance for the given command.
Call another console command.
Call another console command without output.
Call another console command without output.
Run the given console command.
Create an input instance from the given arguments.
Prompt the user until the given validation callback passes.
Validate the given prompt value using the validator.
Get the validator instance that should be used to validate prompts.
Get the validation messages that should be used during prompt validation.
Get the validation attributes that should be used during prompt validation.
Add the disable event dispatcher option to the command.
Disable or enable the event dispatcher based on the input option.
Retrieve the command's input as a CommandInput instance or retrieve an input item.
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.
Format input to textual table.
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.
Get the output component factory implementation.
Get the verbosity level in terms of Symfony's OutputInterface level.
Define a callback to be run when the given signal(s) occurs.
Unregister signal handlers for one, many, or all signals.
Interact with the user before validating the input.
Prompt the user for any missing arguments.
Prompt for missing input arguments using the returned questions.
Perform actions after the user was prompted for missing arguments.
Determine whether the input contains any options that differ from the default values.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
No description
Run the console command.
Configure the console command for isolation.
Configure the command from class attributes.
Configure usage examples for the command from class attributes.
Configure the console command using a fluent definition.
No description
No description
Get a command isolation mutex instance for the command.
No description
Determine if the command is hidden.
Get the Hypervel application instance.
Set up the traits used by the command.
Flush all static state.
Details
at line 401
protected Command
resolveCommand(Command|string $command)
Resolve the console command instance for the given command.
in
CallsCommands at line 23
int
call(Command|string $command, array $arguments = [])
Call another console command.
in
CallsCommands at line 31
int
callSilent(Command|string $command, array $arguments = [])
Call another console command without output.
in
CallsCommands at line 39
int
callSilently(Command|string $command, array $arguments = [])
Call another console command without output.
in
CallsCommands at line 47
protected int
runCommand(Command|string $command, array $arguments, OutputInterface $output)
Run the given console command.
in
CallsCommands at line 64
protected ArrayInput
createInputFromArguments(array $arguments)
Create an input instance from the given arguments.
in
CallsCommands at line 78
protected array
context()
Get all the context passed to the command.
in
ConfiguresPrompts at line 32
protected void
configurePrompts(InputInterface $input)
Configure the prompt fallbacks.
in
ConfiguresPrompts at line 149
protected PResult
promptUntilValid(PResult $prompt, bool|string $required, null|PResult): mixed $validate)
Prompt the user until the given validation callback passes.
in
ConfiguresPrompts at line 185
protected ?string
validatePrompt(mixed $value, mixed $rules)
Validate the given prompt value using the validator.
in
ConfiguresPrompts at line 220
protected Validator
getPromptValidatorInstance(mixed $field, mixed $value, mixed $rules, array $messages = [], array $attributes = [])
Get the validator instance that should be used to validate prompts.
in
ConfiguresPrompts at line 235
protected array
validationMessages()
Get the validation messages that should be used during prompt validation.
in
ConfiguresPrompts at line 245
protected array
validationAttributes()
Get the validation attributes that should be used during prompt validation.
in
DisableEventDispatcher at line 17
void
addDisableDispatcherOption()
Add the disable event dispatcher option to the command.
in
DisableEventDispatcher at line 25
void
disableDispatcher(InputInterface $input)
Disable or enable the event dispatcher based on the input option.
in
HasParameters at line 15
protected void
specifyParameters()
Specify the arguments and options on the command.
in
HasParameters at line 40
protected array
getArguments()
Get the console command arguments.
in
HasParameters at line 48
protected array
getOptions()
Get the console command options.
in
InteractsWithIO at line 53
mixed
input(string|null $key = null, mixed $default = null)
Retrieve the command's input as a CommandInput instance or retrieve an input item.
in
InteractsWithIO at line 63
bool
hasArgument(int|string $name)
Determine if the given argument is present.
in
InteractsWithIO at line 71
mixed
argument(string|null $key = null)
Get the value of a command argument.
in
InteractsWithIO at line 83
array
arguments()
Get all of the arguments passed to the command.
in
InteractsWithIO at line 91
bool
hasOption(string $name)
Determine if the given option is present.
in
InteractsWithIO at line 99
mixed
option(string|null $key = null)
Get the value of a command option.
in
InteractsWithIO at line 111
array
options()
Get all of the options passed to the command.
in
InteractsWithIO at line 119
bool
confirm(string $question, bool $default = false)
Confirm a question with the user.
in
InteractsWithIO at line 127
mixed
ask(string $question, string|null $default = null)
Prompt the user for input.
in
InteractsWithIO at line 135
mixed
anticipate(string $question, iterable|callable $choices, string|null $default = null)
Prompt the user for input with auto completion.
in
InteractsWithIO at line 143
mixed
askWithCompletion(string $question, iterable|callable $choices, string|null $default = null)
Prompt the user for input with auto completion.
in
InteractsWithIO at line 157
mixed
secret(string $question, bool $fallback = true)
Prompt the user for input but hide the answer from the console.
in
InteractsWithIO at line 169
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.
in
InteractsWithIO at line 181
void
table(array $headers, array|Arrayable $rows, string|TableStyle $tableStyle = 'default', array $columnStyles = [])
Format input to textual table.
in
InteractsWithIO at line 201
mixed
withProgressBar(iterable|int $totalSteps, Closure $callback)
Execute a given callback while advancing a progress bar.
in
InteractsWithIO at line 231
void
info(string $string, int|string|null $verbosity = null)
Write a string as information output.
in
InteractsWithIO at line 239
void
line(string $string, string|null $style = null, int|string|null $verbosity = null)
Write a string as standard output.
in
InteractsWithIO at line 249
void
comment(string $string, int|string|null $verbosity = null)
Write a string as comment output.
in
InteractsWithIO at line 257
void
question(string $string, int|string|null $verbosity = null)
Write a string as question output.
in
InteractsWithIO at line 265
void
error(string $string, int|string|null $verbosity = null)
Write a string as error output.
in
InteractsWithIO at line 273
void
warn(string $string, int|string|null $verbosity = null)
Write a string as warning output.
in
InteractsWithIO at line 287
void
alert(string $string, int|string|null $verbosity = null)
Write a string in an alert box.
in
InteractsWithIO at line 301
InteractsWithIO
newLine(int $count = 1)
Write a blank line.
in
InteractsWithIO at line 311
void
setInput(InputInterface $input)
Set the input interface implementation.
in
InteractsWithIO at line 319
void
setOutput(OutputStyle $output)
Set the output interface implementation.
in
InteractsWithIO at line 327
OutputStyle|null
getOutput()
Get the output implementation.
in
InteractsWithIO at line 335
Factory|null
outputComponents()
Get the output component factory implementation.
in
InteractsWithIO at line 343
protected void
setVerbosity(int|string $level)
Set the verbosity level.
in
InteractsWithIO at line 351
protected int
parseVerbosity(int|string|null $level = null)
Get the verbosity level in terms of Symfony's OutputInterface level.
in
InteractsWithSignals at line 20
void
trap(array|int $signo, callable $callback)
Define a callback to be run when the given signal(s) occurs.
in
InteractsWithSignals at line 35
void
untrap(array|int|null $signo = null)
Unregister signal handlers for one, many, or all signals.
in
PromptsForMissingInput at line 22
protected void
interact(InputInterface $input, OutputInterface $output)
Interact with the user before validating the input.
in
PromptsForMissingInput at line 34
protected void
promptForMissingArguments(InputInterface $input, OutputInterface $output)
Prompt the user for any missing arguments.
in
PromptsForMissingInput at line 74
protected array
promptForMissingArgumentsUsing()
Prompt for missing input arguments using the returned questions.
in
PromptsForMissingInput at line 82
protected void
afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
Perform actions after the user was prompted for missing arguments.
in
PromptsForMissingInput at line 89
protected bool
didReceiveOptions(InputInterface $input)
Determine whether the input contains any options that differ from the default values.
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 112
__construct(string|null $name = null)
No description
at line 164
int
run(InputInterface $input, OutputInterface $output)
Run the console command.
at line 187
protected void
configureIsolation()
Configure the console command for isolation.
at line 201
protected void
configureFromAttributes()
Configure the command from class attributes.
at line 243
protected void
configureUsageFromAttribute()
Configure usage examples for the command from class attributes.
at line 255
protected void
configureUsingFluentDefinition()
Configure the console command using a fluent definition.
at line 268
protected void
configure()
No description
at line 273
protected int
execute(InputInterface $input, OutputInterface $output)
No description
at line 366
protected CommandMutex
commandIsolationMutex()
Get a command isolation mutex instance for the command.
at line 373
protected void
replaceOutput()
No description
at line 385
void
fail(string|Throwable|null $exception = null)
Fail the command manually.
at line 427
bool
isHidden()
Determine if the command is hidden.
at line 435
Command
setHidden(bool $hidden = true)
Set whether the command is hidden.
at line 447
Application
getHypervel()
Get the Hypervel application instance.
at line 459
void
setHypervel(Application $hypervel)
Set the Hypervel application instance.
at line 467
protected array
setUpTraits(InputInterface $input, OutputInterface $output)
Set up the traits used by the command.
at line 483
static void
flushState()
Flush all static state.