Kernel
class Kernel implements Kernel (View source)
Traits
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> deprecated | $routeMiddleware | The application's route middleware. |
|
protected array<string,class-string|string> | $middlewareAliases | The application's middleware aliases. |
|
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
Get the number of seconds until the given DateTime.
If the given value is an interval, convert it to a DateTime instance.
Given a start time, format the total run time for human readability.
Handle an incoming HTTP request.
Bootstrap the application for HTTP requests.
Get the route dispatcher callback.
Call the terminate method on any terminable middleware.
Call the terminate method on any terminable middleware.
Register a callback to be invoked when the requests lifecycle duration exceeds a given amount of time.
When the request being handled started.
Parse a middleware string to get the name and parameters.
Determine if the kernel has a given middleware.
Add a new middleware to the beginning of the stack if it does not already exist.
Add a new middleware to end of the stack if it does not already exist.
Prepend the given middleware to the given middleware group.
Append the given middleware to the given middleware group.
Prepend the given middleware to the middleware priority list.
Append the given middleware to the middleware priority list.
Add the given middleware to the middleware priority list before other middleware.
Add the given middleware to the middleware priority list after other middleware.
Add the given middleware to the middleware priority list relative to other middleware.
Sync the current state of the middleware to the router.
Get the priority-sorted list of middleware.
Get the bootstrap classes for the application.
Get the application's global middleware.
Set the application's global middleware.
Get the application's route middleware groups.
Set the application's middleware groups.
Get the application's route middleware aliases.
Set the application's route middleware aliases.
Set the application's middleware priority.
Get 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 string
runTimeForHumans(float $startTime, float $endTime = null)
Given a start time, format the total run time for human readability.
protected Response
sendRequestThroughRouter(Request $request)
Send the given request through the middleware / router.
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.
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.
$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.
$this
addToMiddlewarePriorityBefore(array|string $before, string $middleware)
Add the given middleware to the middleware priority list before other middleware.
$this
addToMiddlewarePriorityAfter(array|string $after, string $middleware)
Add the given middleware to the middleware priority list after other middleware.
protected $this
addToMiddlewarePriorityRelative(string|array $existing, string $middleware, bool $after = true)
Add the given middleware to the middleware priority list relative to other middleware.
protected Response
renderException(Request $request, Throwable $e)
Render the exception to a response.