Kernel.php
TLDR
This file defines the Kernel
interface for the console in the Illuminate contracts. It contains methods for handling console commands, running Artisan commands, queuing commands, retrieving registered commands, getting the output of the last command run, and terminating the application.
Methods
bootstrap
This method is used to bootstrap the application for artisan commands.
handle
This method handles an incoming console command. It takes an input interface and an optional output interface as parameters, and returns an integer status code.
call
This method runs an Artisan console command by name. It takes the command name, an array of parameters, and an optional output buffer as parameters, and returns an integer status code.
queue
This method queues an Artisan console command by name. It takes the command name and an array of parameters as parameters, and returns a PendingDispatch
object.
all
This method retrieves all of the commands registered with the console. It returns an array.
output
This method gets the output for the last run command. It returns a string.
terminate
This method is used to terminate the application. It takes an input interface and a status code as parameters.
<?php
namespace Illuminate\Contracts\Console;
interface Kernel
{
/**
* Bootstrap the application for artisan commands.
*
* @return void
*/
public function bootstrap();
/**
* Handle an incoming console command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface|null $output
* @return int
*/
public function handle($input, $output = null);
/**
* Run an Artisan console command by name.
*
* @param string $command
* @param array $parameters
* @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer
* @return int
*/
public function call($command, array $parameters = [], $outputBuffer = null);
/**
* Queue an Artisan console command by name.
*
* @param string $command
* @param array $parameters
* @return \Illuminate\Foundation\Bus\PendingDispatch
*/
public function queue($command, array $parameters = []);
/**
* Get all of the commands registered with the console.
*
* @return array
*/
public function all();
/**
* Get the output for the last run command.
*
* @return string
*/
public function output();
/**
* Terminate the application.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param int $status
* @return void
*/
public function terminate($input, $status);
}