class Middleware (View source)

Properties

protected array $global

The user defined global middleware stack.

protected array $prepends

The middleware that should be prepended to the global middleware stack.

protected array $appends

The middleware that should be appended to the global middleware stack.

protected array $removals

The middleware that should be removed from the global middleware stack.

protected array $replacements

The middleware that should be replaced in the global middleware stack.

protected array $groups

The user defined middleware groups.

protected array $groupPrepends

The middleware that should be prepended to the specified groups.

protected array $groupAppends

The middleware that should be appended to the specified groups.

protected array $groupRemovals

The middleware that should be removed from the specified groups.

protected array $groupReplacements

The middleware that should be replaced in the specified groups.

protected array $pageMiddleware

The Folio / page middleware for the application.

protected bool $trustHosts

Indicates if the "trust hosts" middleware is enabled.

protected bool $statefulApi

Indicates if Sanctum's frontend state middleware is enabled.

protected string $apiLimiter

Indicates the API middleware group's rate limiter.

protected bool $throttleWithRedis

Indicates if Redis throttling should be applied.

protected bool $authenticatedSessions

Indicates if sessions should be authenticated for the "web" middleware group.

protected array $customAliases

The custom middleware aliases.

protected array $priority

The custom middleware priority definition.

Methods

$this
prepend(array|string $middleware)

Prepend middleware to the application's global middleware stack.

$this
append(array|string $middleware)

Append middleware to the application's global middleware stack.

$this
remove(array|string $middleware)

Remove middleware from the application's global middleware stack.

$this
replace(string $search, string $replace)

Specify a middleware that should be replaced with another middleware.

$this
use(array $middleware)

Define the global middleware for the application.

$this
group(string $group, array $middleware)

Define a middleware group.

$this
prependToGroup(string $group, array|string $middleware)

Prepend the given middleware to the specified group.

$this
appendToGroup(string $group, array|string $middleware)

Append the given middleware to the specified group.

$this
removeFromGroup(string $group, array|string $middleware)

Remove the given middleware from the specified group.

$this
replaceInGroup(string $group, string $search, string $replace)

Replace the given middleware in the specified group with another middleware.

$this
web(array|string $append = [], array|string $prepend = [], array|string $remove = [], array $replace = [])

Modify the middleware in the "web" group.

$this
api(array|string $append = [], array|string $prepend = [], array|string $remove = [], array $replace = [])

Modify the middleware in the "api" group.

$this
modifyGroup(string $group, array|string $append, array|string $prepend, array|string $remove, array $replace)

Modify the middleware in the given group.

$this
pages(array $middleware)

Register the Folio / page middleware for the application.

$this
alias(array $aliases)

Register additional middleware aliases.

$this
priority(array $priority)

Define the middleware priority for the application.

array
getGlobalMiddleware()

Get the global middleware.

array
getMiddlewareGroups()

Get the middleware groups.

$this
redirectGuestsTo(callable|string $redirect)

Configure where guests are redirected by the authentication middleware.

$this
redirectTo(callable|string $guests = null, callable|string $users = null)

Configure where users are redirected by the authentication and guest middleware.

$this
encryptCookies(array $except = [])

Configure the cookie encryption middleware.

$this
validateCsrfTokens(array $except = [])

Configure the CSRF token validation middleware.

$this
validateSignatures(array $except = [])

Configure the URL signature validation middleware.

$this
convertEmptyStringsToNull(array $except = [])

Configure the empty string conversion middleware.

$this
trimStrings(array $except = [])

Configure the string trimming middleware.

$this
trustHosts(array $at = null, bool $subdomains = true)

Indicate that the trusted host middleware should be enabled.

$this
trustProxies(array|string $at = null, int $headers = null)

Configure the trusted proxies for the application.

$this
preventRequestsDuringMaintenance(array $except = [])

Configure the middleware that prevents requests during maintenance mode.

$this
statefulApi()

Indicate that Sanctum's frontend state middleware should be enabled.

$this
throttleApi(string $limiter = 'api', bool $redis = false)

Indicate that the API middleware group's throttling middleware should be enabled.

$this
throttleWithRedis()

Indicate that Laravel's throttling middleware should use Redis.

$this
authenticateSessions()

Indicate that sessions should be authenticated for the "web" middleware group.

array
getPageMiddleware()

Get the Folio / page middleware for the application.

array
getMiddlewareAliases()

Get the middleware aliases.

array
defaultAliases()

Get the default middleware aliases.

array
getMiddlewarePriority()

Get the middleware priority for the application.

Details

$this prepend(array|string $middleware)

Prepend middleware to the application's global middleware stack.

Parameters

array|string $middleware

Return Value

$this

$this append(array|string $middleware)

Append middleware to the application's global middleware stack.

Parameters

array|string $middleware

Return Value

$this

$this remove(array|string $middleware)

Remove middleware from the application's global middleware stack.

Parameters

array|string $middleware

Return Value

$this

$this replace(string $search, string $replace)

Specify a middleware that should be replaced with another middleware.

Parameters

string $search
string $replace

Return Value

$this

$this use(array $middleware)

Define the global middleware for the application.

Parameters

array $middleware

Return Value

$this

$this group(string $group, array $middleware)

Define a middleware group.

Parameters

string $group
array $middleware

Return Value

$this

$this prependToGroup(string $group, array|string $middleware)

Prepend the given middleware to the specified group.

Parameters

string $group
array|string $middleware

Return Value

$this

$this appendToGroup(string $group, array|string $middleware)

Append the given middleware to the specified group.

Parameters

string $group
array|string $middleware

Return Value

$this

$this removeFromGroup(string $group, array|string $middleware)

Remove the given middleware from the specified group.

Parameters

string $group
array|string $middleware

Return Value

$this

$this replaceInGroup(string $group, string $search, string $replace)

Replace the given middleware in the specified group with another middleware.

Parameters

string $group
string $search
string $replace

Return Value

$this

$this web(array|string $append = [], array|string $prepend = [], array|string $remove = [], array $replace = [])

Modify the middleware in the "web" group.

Parameters

array|string $append
array|string $prepend
array|string $remove
array $replace

Return Value

$this

$this api(array|string $append = [], array|string $prepend = [], array|string $remove = [], array $replace = [])

Modify the middleware in the "api" group.

Parameters

array|string $append
array|string $prepend
array|string $remove
array $replace

Return Value

$this

protected $this modifyGroup(string $group, array|string $append, array|string $prepend, array|string $remove, array $replace)

Modify the middleware in the given group.

Parameters

string $group
array|string $append
array|string $prepend
array|string $remove
array $replace

Return Value

$this

$this pages(array $middleware)

Register the Folio / page middleware for the application.

Parameters

array $middleware

Return Value

$this

$this alias(array $aliases)

Register additional middleware aliases.

Parameters

array $aliases

Return Value

$this

$this priority(array $priority)

Define the middleware priority for the application.

Parameters

array $priority

Return Value

$this

array getGlobalMiddleware()

Get the global middleware.

Return Value

array

array getMiddlewareGroups()

Get the middleware groups.

Return Value

array

$this redirectGuestsTo(callable|string $redirect)

Configure where guests are redirected by the authentication middleware.

Parameters

callable|string $redirect

Return Value

$this

$this redirectTo(callable|string $guests = null, callable|string $users = null)

Configure where users are redirected by the authentication and guest middleware.

Parameters

callable|string $guests
callable|string $users

Return Value

$this

$this encryptCookies(array $except = [])

Configure the cookie encryption middleware.

Parameters

array $except

Return Value

$this

$this validateCsrfTokens(array $except = [])

Configure the CSRF token validation middleware.

Parameters

array $except

Return Value

$this

$this validateSignatures(array $except = [])

Configure the URL signature validation middleware.

Parameters

array $except

Return Value

$this

$this convertEmptyStringsToNull(array $except = [])

Configure the empty string conversion middleware.

Parameters

array $except

Return Value

$this

$this trimStrings(array $except = [])

Configure the string trimming middleware.

Parameters

array $except

Return Value

$this

$this trustHosts(array $at = null, bool $subdomains = true)

Indicate that the trusted host middleware should be enabled.

Parameters

array $at
bool $subdomains

Return Value

$this

$this trustProxies(array|string $at = null, int $headers = null)

Configure the trusted proxies for the application.

Parameters

array|string $at
int $headers

Return Value

$this

$this preventRequestsDuringMaintenance(array $except = [])

Configure the middleware that prevents requests during maintenance mode.

Parameters

array $except

Return Value

$this

$this statefulApi()

Indicate that Sanctum's frontend state middleware should be enabled.

Return Value

$this

$this throttleApi(string $limiter = 'api', bool $redis = false)

Indicate that the API middleware group's throttling middleware should be enabled.

Parameters

string $limiter
bool $redis

Return Value

$this

$this throttleWithRedis()

Indicate that Laravel's throttling middleware should use Redis.

Return Value

$this

$this authenticateSessions()

Indicate that sessions should be authenticated for the "web" middleware group.

Return Value

$this

array getPageMiddleware()

Get the Folio / page middleware for the application.

Return Value

array

array getMiddlewareAliases()

Get the middleware aliases.

Return Value

array

protected array defaultAliases()

Get the default middleware aliases.

Return Value

array

array getMiddlewarePriority()

Get the middleware priority for the application.

Return Value

array