master

laravel/framework

Last updated at: 29/12/2023 09:21

Kernel.php

TLDR

This file defines an interface Kernel in the Illuminate\Contracts\Http namespace. The interface has several methods related to handling HTTP requests and managing the Laravel application.

Methods

There are several methods defined in this file:

bootstrap

This method is used to bootstrap the application for HTTP requests. It does not take any parameters and does not return anything.

handle

This method is used to handle an incoming HTTP request. It takes a \Symfony\Component\HttpFoundation\Request object as a parameter and returns a \Symfony\Component\HttpFoundation\Response object.

terminate

This method is used to perform any final actions for the request lifecycle. It takes a \Symfony\Component\HttpFoundation\Request object and a \Symfony\Component\HttpFoundation\Response object as parameters and does not return anything.

getApplication

This method is used to get the Laravel application instance. It does not take any parameters and returns an instance of \Illuminate\Contracts\Foundation\Application.

<?php

namespace Illuminate\Contracts\Http;

interface Kernel
{
    /**
     * Bootstrap the application for HTTP requests.
     *
     * @return void
     */
    public function bootstrap();

    /**
     * Handle an incoming HTTP request.
     *
     * @param  \Symfony\Component\HttpFoundation\Request  $request
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function handle($request);

    /**
     * Perform any final actions for the request lifecycle.
     *
     * @param  \Symfony\Component\HttpFoundation\Request  $request
     * @param  \Symfony\Component\HttpFoundation\Response  $response
     * @return void
     */
    public function terminate($request, $response);

    /**
     * Get the Laravel application instance.
     *
     * @return \Illuminate\Contracts\Foundation\Application
     */
    public function getApplication();
}