Application
class Application extends Application implements Application
Constants
| protected LAST_OUTPUT_CONTEXT_KEY |
The CoroutineContext key holding the output from the previous command. |
Properties
| static protected array<array-key, Closure(static): void> | $bootstrappers | The console application bootstrappers. |
|
| protected array | $commandMap | A map of command names to classes. |
|
| protected bool | $commandLoaderSet | Whether the container command loader has been set. |
Methods
Get all commands registered with the application.
Run the console application.
Determine the proper PHP executable.
Determine the proper Artisan executable.
Format the given command as a fully-qualified executable command.
Bootstrap the console application.
Clear the console application bootstrappers.
Run an Artisan console command by name.
Run a command without Symfony's process-global CLI wrapper.
Configure the input and output for a programmatic command.
Parse the incoming Artisan command and its input.
Get the output for the last run command.
Alias for addCommand() since Symfony's add() method was deprecated.
Add a command to the console.
Add the command to the parent instance.
Run the given command instance.
Create a per-execution command instance from the cached command prototype.
Add a command, resolving through the application.
Extract the command name from a class without instantiation.
Extract the command name from a signature string.
Extract command aliases from a class without instantiation.
Resolve an array of commands through the application.
Set the container command loader for lazy resolution.
Get the default input definition for the application.
Get the global environment option for the definition.
Get the Hypervel application instance.
Details
at line 56
__construct(Application $container, Dispatcher $dispatcher, string $version)
No description
at line 83
array
all(string|null $namespace = null)
Get all commands registered with the application.
at line 92
int
run(InputInterface|null $input = null, OutputInterface|null $output = null)
Run the console application.
at line 101
static string
phpBinary()
Determine the proper PHP executable.
at line 111
static string
artisanBinary()
Determine the proper Artisan executable.
at line 121
static string
formatCommandString(string $string)
Format the given command as a fully-qualified executable command.
at line 134
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.
at line 142
protected void
bootstrap()
Bootstrap the console application.
at line 155
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.
at line 165
int
call(string|Command $command, array $parameters = [], OutputInterface|null $outputBuffer = null)
Run an Artisan console command by name.
at line 193
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.
at line 205
protected void
configureProgrammaticIO(InputInterface $input, OutputInterface $output)
Configure the input and output for a programmatic command.
at line 248
protected array
parseCommand(string|Command $command, array $parameters)
Parse the incoming Artisan command and its input.
at line 274
string
output()
Get the output for the last run command.
at line 286
Command|null
add(Command $command)
Alias for addCommand() since Symfony's add() method was deprecated.
at line 294
Command|null
addCommand(Command|callable $command)
Add a command to the console.
at line 306
protected Command|null
addToParent(Command|callable $command)
Add the command to the parent instance.
at line 314
protected int
doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
Run the given command instance.
at line 331
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.
at line 352
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.
at line 390
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.
at line 428
static protected string|null
extractCommandNameFromSignature(string $signature)
Extract the command name from a signature string.
at line 445
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().
at line 475
Application
resolveCommands(array|Command|string ...$commands)
Resolve an array of commands through the application.
at line 491
Application
setContainerCommandLoader()
Set the container command loader for lazy resolution.
at line 507
protected InputDefinition
getDefaultInputDefinition()
Get the default input definition for the application.
This is used to add the --env option to every available command.
at line 520
protected InputOption
getEnvironmentOption()
Get the global environment option for the definition.
at line 530
Application
getHypervel()
Get the Hypervel application instance.