Kernel
class Kernel implements Kernel (View source)
Traits
InteractsWithTime |
Properties
protected Application | $app | The application implementation. | |
protected Router | $router | The router instance. | |
protected string[] | $bootstrappers | The bootstrap classes for the application. | |
protected array<int,class-string|string> | $middleware | The application's middleware stack. | |
protected array<string,array<int,class-string|string>> | $middlewareGroups | The application's route middleware groups. | |
protected array<string,class-string|string> | $routeMiddleware | The application's route middleware. | |
protected array | $requestLifecycleDurationHandlers | All of the registered request duration handlers. | |
protected Carbon|null | $requestStartedAt | When the kernel starting handling the current request. | |
protected string[] | $middlewarePriority | The priority-sorted list of middleware. |
Methods
int | secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime. | from InteractsWithTime |
int | availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp. | from InteractsWithTime |
DateTimeInterface|int | parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance. | from InteractsWithTime |
int | currentTime()
Get the current system time as a UNIX timestamp. | from InteractsWithTime |
void | __construct(Application $app, Router $router)
Create a new HTTP kernel instance. | |
Response | handle(Request $request)
Handle an incoming HTTP request. | |
Response | sendRequestThroughRouter(Request $request)
Send the given request through the middleware / router. | |
void | bootstrap()
Bootstrap the application for HTTP requests. | |
Closure | dispatchToRouter()
Get the route dispatcher callback. | |
void | terminate(Request $request, Response $response)
Call the terminate method on any terminable middleware. | |
void | terminateMiddleware(Request $request, Response $response)
Call the terminate method on any terminable middleware. | |
void | whenRequestLifecycleIsLongerThan(DateTimeInterface|CarbonInterval|float|int $threshold, callable $handler)
Register a callback to be invoked when the requests lifecycle duration exceeds a given amount of time. | |
Carbon|null | requestStartedAt()
When the request being handled started. | |
array | gatherRouteMiddleware(Request $request)
Gather the route middleware for the given request. | |
array | parseMiddleware(string $middleware)
Parse a middleware string to get the name and parameters. | |
bool | hasMiddleware(string $middleware)
Determine if the kernel has a given middleware. | |
$this | prependMiddleware(string $middleware)
Add a new middleware to the beginning of the stack if it does not already exist. | |
$this | pushMiddleware(string $middleware)
Add a new middleware to end of the stack if it does not already exist. | |
$this | prependMiddlewareToGroup(string $group, string $middleware)
Prepend the given middleware to the given middleware group. | |
$this | appendMiddlewareToGroup(string $group, string $middleware)
Append the given middleware to the given middleware group. | |
$this | prependToMiddlewarePriority(string $middleware)
Prepend the given middleware to the middleware priority list. | |
$this | appendToMiddlewarePriority(string $middleware)
Append the given middleware to the middleware priority list. | |
void | syncMiddlewareToRouter()
Sync the current state of the middleware to the router. | |
array | getMiddlewarePriority()
Get the priority-sorted list of middleware. | |
array | bootstrappers()
Get the bootstrap classes for the application. | |
void | reportException(Throwable $e)
Report the exception to the exception handler. | |
Response | renderException(Request $request, Throwable $e)
Render the exception to a response. | |
array | getMiddlewareGroups()
Get the application's route middleware groups. | |
array | getRouteMiddleware()
Get the application's route middleware. | |
Application | getApplication()
Get the Laravel application instance. | |
$this | setApplication(Application $app)
Set the Laravel application instance. |
Details
protected int secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime.
protected int availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp.
protected DateTimeInterface|int parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance.
protected int currentTime()
Get the current system time as a UNIX timestamp.
void __construct(Application $app, Router $router)
Create a new HTTP kernel instance.
Response handle(Request $request)
Handle an incoming HTTP request.
protected Response sendRequestThroughRouter(Request $request)
Send the given request through the middleware / router.
void bootstrap()
Bootstrap the application for HTTP requests.
protected Closure dispatchToRouter()
Get the route dispatcher callback.
void terminate(Request $request, Response $response)
Call the terminate method on any terminable middleware.
protected void terminateMiddleware(Request $request, Response $response)
Call the terminate method on any terminable middleware.
void whenRequestLifecycleIsLongerThan(DateTimeInterface|CarbonInterval|float|int $threshold, callable $handler)
Register a callback to be invoked when the requests lifecycle duration exceeds a given amount of time.
Carbon|null requestStartedAt()
When the request being handled started.
protected array gatherRouteMiddleware(Request $request)
Gather the route middleware for the given request.
protected array parseMiddleware(string $middleware)
Parse a middleware string to get the name and parameters.
bool hasMiddleware(string $middleware)
Determine if the kernel has a given middleware.
$this prependMiddleware(string $middleware)
Add a new middleware to the beginning of the stack if it does not already exist.
$this pushMiddleware(string $middleware)
Add a new middleware to end of the stack if it does not already exist.
$this prependMiddlewareToGroup(string $group, string $middleware)
Prepend the given middleware to the given middleware group.
$this appendMiddlewareToGroup(string $group, string $middleware)
Append the given middleware to the given middleware group.
$this prependToMiddlewarePriority(string $middleware)
Prepend the given middleware to the middleware priority list.
$this appendToMiddlewarePriority(string $middleware)
Append the given middleware to the middleware priority list.
protected void syncMiddlewareToRouter()
Sync the current state of the middleware to the router.
array getMiddlewarePriority()
Get the priority-sorted list of middleware.
protected array bootstrappers()
Get the bootstrap classes for the application.
protected void reportException(Throwable $e)
Report the exception to the exception handler.
protected Response renderException(Request $request, Throwable $e)
Render the exception to a response.
array getMiddlewareGroups()
Get the application's route middleware groups.
array getRouteMiddleware()
Get the application's route middleware.
Application getApplication()
Get the Laravel application instance.
$this setApplication(Application $app)
Set the Laravel application instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/9.x/Illuminate/Foundation/Http/Kernel.html