class Application extends Application implements Application

Constants

protected LAST_OUTPUT_CONTEXT_KEY

The CoroutineContext key holding the output from the previous command.

private DEFERRED_CALLBACK_OWNER_CONTEXT_KEY

The CoroutineContext key marking the owner of non-coroutine deferred callbacks.

Properties

static protected array<array-key, Closure(static): mixed> $bootstrappers

The console application bootstrappers.

protected Command>> $commandMap

A map of command names to classes.

protected bool $commandLoaderSet

Whether the container command loader has been set.

Methods

__construct(Application $container, Dispatcher $dispatcher, string $version)

Create a new console application instance.

Command
get(string $name)

Get a registered command by name or alias.

bool
has(string $name)

Determine if a command exists.

array
all(string|null $namespace = null)

Get all commands registered with the application.

int
run(InputInterface|null $input = null, OutputInterface|null $output = null)

Run the console application.

static string
phpBinary()

Determine the proper PHP executable.

static string
artisanBinary()

Determine the proper Artisan executable.

static string|null
resolveCommandName(ArgvInput $input)

Resolve the command name from argv before the console application boots.

static string
formatCommandString(string $string)

Format the given command as a fully-qualified executable command.

static void
starting(Closure $callback)

Register a console "starting" bootstrapper.

void
bootstrap()

Bootstrap the console application.

static void
forgetBootstrappers()

Clear the console application bootstrappers.

int
call(string|Command $command, array $parameters = [], OutputInterface|null $outputBuffer = null)

Run an Artisan console command by name.

int
runProgrammatically(InputInterface $input, OutputInterface $output)

Run a command without Symfony's process-global CLI wrapper.

void
configureProgrammaticIO(InputInterface $input, OutputInterface $output)

Configure the input and output for a programmatic command.

array
parseCommand(string|Command $command, array $parameters)

Parse the incoming Artisan command and its input.

string
output()

Get the output for the last run command.

Command|null
add(Command $command)

Alias for addCommand() since Symfony's add() method was deprecated.

Command|null
addCommand(Command|callable $command)

Add a command to the console.

Command|null
addToParent(Command|callable $command)

Add the command to the parent instance.

int
doRunCommand(Command $command, InputInterface $input, OutputInterface $output)

Run the given command instance.

Command
freshCommandForRun(Command $command)

Create a per-execution command instance from the cached command prototype.

Command|null
resolve(Command|string $command)

Add a command, resolving through the application.

static string|null
extractCommandName(string $command)

Extract the command name from a class without instantiation.

static string|null
extractCommandNameFromSignature(string $signature)

Extract the command name from a signature string.

static array
extractCommandAliases(string $command)

Extract command aliases from a class without instantiation.

resolveCommands(array|Command|string ...$commands)

Resolve an array of commands through the application.

setContainerCommandLoader()

Set the container command loader for lazy resolution.

InputDefinition
getDefaultInputDefinition()

Get the default input definition for the application.

InputOption
getEnvironmentOption()

Get the global environment option for the definition.

getHypervel()

Get the Hypervel application instance.

Details

at line 74
__construct(Application $container, Dispatcher $dispatcher, string $version)

Create a new console application instance.

Parameters

Application $container
Dispatcher $dispatcher
string $version

at line 105
Command get(string $name)

Get a registered command by name or alias.

Parameters

string $name

Return Value

Command

Exceptions

CommandNotFoundException

at line 114
bool has(string $name)

Determine if a command exists.

Parameters

string $name

Return Value

bool

at line 123
array all(string|null $namespace = null)

Get all commands registered with the application.

Parameters

string|null $namespace

Return Value

array

at line 132
int run(InputInterface|null $input = null, OutputInterface|null $output = null)

Run the console application.

Parameters

InputInterface|null $input
OutputInterface|null $output

Return Value

int

at line 141
static string phpBinary()

Determine the proper PHP executable.

Return Value

string

at line 151
static string artisanBinary()

Determine the proper Artisan executable.

Return Value

string

at line 165
static string|null resolveCommandName(ArgvInput $input)

Resolve the command name from argv before the console application boots.

Symfony's inherited getCommandName() reports the command selected by a running application. This method first binds the framework's global options so their values are not mistaken for the command name.

Parameters

ArgvInput $input

Return Value

string|null

at line 186
static string formatCommandString(string $string)

Format the given command as a fully-qualified executable command.

Parameters

string $string

Return Value

string

at line 199
static void starting(Closure $callback)

Register a console "starting" bootstrapper.

Boot-only. The bootstrapper persists in a static property for the worker lifetime and runs for every subsequent console application instance.

Parameters

Closure $callback

Return Value

void

at line 207
protected void bootstrap()

Bootstrap the console application.

Return Value

void

at line 220
static void forgetBootstrappers()

Clear the console application bootstrappers.

Boot or tests only. Clears worker-wide console bootstrappers; concurrent console application creation may observe different startup hooks.

Return Value

void

at line 230
int call(string|Command $command, array $parameters = [], OutputInterface|null $outputBuffer = null)

Run an Artisan console command by name.

Parameters

string|Command $command
array $parameters
OutputInterface|null $outputBuffer

Return Value

int

Exceptions

CommandNotFoundException

at line 258
protected int runProgrammatically(InputInterface $input, OutputInterface $output)

Run a command without Symfony's process-global CLI wrapper.

Symfony's run() owns root CLI concerns: terminal environment export, process-global exception handling, shell-verbosity restoration, and auto-exit. Programmatic calls need explicit IO configuration and doRun() only. Keep this boundary aligned with Symfony through the parity tests.

Parameters

InputInterface $input
OutputInterface $output

Return Value

int

See also

\Symfony\Component\Console\Application::run()

at line 270
protected void configureProgrammaticIO(InputInterface $input, OutputInterface $output)

Configure the input and output for a programmatic command.

Parameters

InputInterface $input
OutputInterface $output

Return Value

void

at line 315
protected array parseCommand(string|Command $command, array $parameters)

Parse the incoming Artisan command and its input.

Parameters

string|Command $command
array $parameters

Return Value

array

at line 341
string output()

Get the output for the last run command.

Return Value

string

at line 353
Command|null add(Command $command)

Alias for addCommand() since Symfony's add() method was deprecated.

Parameters

Command $command

Return Value

Command|null

at line 361
Command|null addCommand(Command|callable $command)

Add a command to the console.

Parameters

Command|callable $command

Return Value

Command|null

at line 373
protected Command|null addToParent(Command|callable $command)

Add the command to the parent instance.

Parameters

Command|callable $command

Return Value

Command|null

at line 381
protected int doRunCommand(Command $command, InputInterface $input, OutputInterface $output)

Run the given command instance.

Parameters

Command $command
InputInterface $input
OutputInterface $output

Return Value

int

at line 436
protected Command freshCommandForRun(Command $command)

Create a per-execution command instance from the cached command prototype.

Symfony caches command objects after lazy resolution, but Hypervel commands store input/output state while running. Execute clones so concurrent calls to the same command cannot overwrite each other's per-run state.

Parameters

Command $command

Return Value

Command

at line 457
Command|null resolve(Command|string $command)

Add a command, resolving through the application.

Commands whose name can be determined statically (#[AsCommand],

[Signature], $signature, or $name property) are added to the commandMap

for lazy resolution via ContainerCommandLoader. Commands without a static name fall back to eager resolution through the container.

Parameters

Command|string $command

Return Value

Command|null

at line 495
static protected string|null extractCommandName(string $command)

Extract the command name from a class without instantiation.

Checks (in order): #[AsCommand] attribute, #[Signature] attribute, $signature property default, $name property default. Returns null if the name can only be determined at construction time.

Parameters

string $command

Return Value

string|null

at line 533
static protected string|null extractCommandNameFromSignature(string $signature)

Extract the command name from a signature string.

Parameters

string $signature

Return Value

string|null

at line 550
static protected array extractCommandAliases(string $command)

Extract command aliases from a class without instantiation.

Reads #[Aliases] first, then #[Signature] aliases, then the $aliases property default.

[AsCommand] aliases are already baked into the name string as

pipe-separated values by Symfony, so they are handled by extractCommandName() + the explode('|') in resolve().

Parameters

string $command

Return Value

array

at line 580
Application resolveCommands(array|Command|string ...$commands)

Resolve an array of commands through the application.

Parameters

array|Command|string ...$commands

Return Value

Application

at line 596
Application setContainerCommandLoader()

Set the container command loader for lazy resolution.

Return Value

Application

at line 612
protected InputDefinition getDefaultInputDefinition()

Get the default input definition for the application.

This is used to add the --env option to every available command.

Return Value

InputDefinition

at line 623
protected InputOption getEnvironmentOption()

Get the global environment option for the definition.

Return Value

InputOption

at line 644
Application getHypervel()

Get the Hypervel application instance.

Return Value

Application