Middleware
class Middleware
Properties
| protected array|null | $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 bool | $trustHosts | Indicates if the "trust hosts" middleware is enabled. |
|
| protected bool | $statefulApi | Indicates if Sanctum's frontend state middleware is enabled. |
|
| protected string|null | $apiLimiter | Indicates the API middleware group's rate limiter. |
|
| 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. |
|
| protected array | $prependPriority | The middleware to prepend to the middleware priority definition. |
|
| protected array | $appendPriority | The middleware to append to the middleware priority definition. |
Methods
Prepend middleware to the application's global middleware stack.
Append middleware to the application's global middleware stack.
Remove middleware from the application's global middleware stack.
Specify a middleware that should be replaced with another middleware.
Define the global middleware for the application.
Define a middleware group.
Prepend the given middleware to the specified group.
Append the given middleware to the specified group.
Remove the given middleware from the specified group.
Replace the given middleware in the specified group with another middleware.
Modify the middleware in the "web" group.
Modify the middleware in the "api" group.
Modify the middleware in the given group.
Register additional middleware aliases.
Define the middleware priority for the application.
Prepend middleware to the priority middleware.
Append middleware to the priority middleware.
Get the global middleware.
Get the middleware groups.
Configure where guests are redirected by the "auth" middleware.
Configure where users are redirected by the "guest" middleware.
Configure where users are redirected by the authentication and guest middleware.
Configure the cookie encryption middleware.
Configure the request forgery prevention middleware.
Configure the URL signature validation middleware.
Configure the empty string conversion middleware.
Configure the string trimming middleware.
Indicate that the trusted host middleware should be enabled.
Configure the trusted proxies for the application.
Configure the middleware that prevents requests during maintenance mode.
Indicate that Sanctum's frontend state middleware should be enabled.
Indicate that the API middleware group's throttling middleware should be enabled.
Indicate that sessions should be authenticated for the "web" middleware group.
Get the middleware aliases.
Get the default middleware aliases.
Get the middleware priority for the application.
Get the middleware to prepend to the middleware priority definition.
Get the middleware to append to the middleware priority definition.
Details
at line 117
Middleware
prepend(array|string $middleware)
Prepend middleware to the application's global middleware stack.
at line 130
Middleware
append(array|string $middleware)
Append middleware to the application's global middleware stack.
at line 143
Middleware
remove(array|string $middleware)
Remove middleware from the application's global middleware stack.
at line 156
Middleware
replace(string $search, string $replace)
Specify a middleware that should be replaced with another middleware.
at line 166
Middleware
use(array $middleware)
Define the global middleware for the application.
at line 176
Middleware
group(string $group, array $middleware)
Define a middleware group.
at line 186
Middleware
prependToGroup(string $group, array|string $middleware)
Prepend the given middleware to the specified group.
at line 199
Middleware
appendToGroup(string $group, array|string $middleware)
Append the given middleware to the specified group.
at line 212
Middleware
removeFromGroup(string $group, array|string $middleware)
Remove the given middleware from the specified group.
at line 225
Middleware
replaceInGroup(string $group, string $search, string $replace)
Replace the given middleware in the specified group with another middleware.
at line 235
Middleware
web(array|string $append = [], array|string $prepend = [], array|string $remove = [], array $replace = [])
Modify the middleware in the "web" group.
at line 243
Middleware
api(array|string $append = [], array|string $prepend = [], array|string $remove = [], array $replace = [])
Modify the middleware in the "api" group.
at line 251
protected Middleware
modifyGroup(string $group, array|string $append, array|string $prepend, array|string $remove, array $replace)
Modify the middleware in the given group.
at line 279
Middleware
alias(array $aliases)
Register additional middleware aliases.
at line 289
Middleware
priority(array $priority)
Define the middleware priority for the application.
at line 299
Middleware
prependToPriorityList(array|string $before, string $prepend)
Prepend middleware to the priority middleware.
at line 309
Middleware
appendToPriorityList(array|string $after, string $append)
Append middleware to the priority middleware.
at line 319
array
getGlobalMiddleware()
Get the global middleware.
at line 348
array
getMiddlewareGroups()
Get the middleware groups.
at line 406
Middleware
redirectGuestsTo(callable|string|null $redirect)
Configure where guests are redirected by the "auth" middleware.
Boot-only. The callback persists in authentication middleware and exception static properties for the worker lifetime and affects every subsequent unauthenticated or session-mismatch request.
at line 420
Middleware
redirectUsersTo(callable|string $redirect)
Configure where users are redirected by the "guest" middleware.
Boot-only. The callback persists in the guest middleware static property for the worker lifetime and affects every subsequent already-authenticated guest-route request.
at line 432
Middleware
redirectTo(callable|string|null $guests = null, callable|string|null $users = null)
Configure where users are redirected by the authentication and guest middleware.
Boot-only. The callbacks persist in authentication middleware and exception static properties for the worker lifetime and affect every subsequent matching request.
at line 445
Middleware
encryptCookies(array $except = [], array $only = [])
Configure the cookie encryption middleware.
at line 461
Middleware
preventRequestForgery(array $except = [], bool $originOnly = false, bool $allowSameSite = false)
Configure the request forgery prevention middleware.
at line 481
Middleware
validateSignatures(array $except = [])
Configure the URL signature validation middleware.
at line 493
Middleware
convertEmptyStringsToNull(array $except = [])
Configure the empty string conversion middleware.
at line 505
Middleware
trimStrings(array $except = [])
Configure the string trimming middleware.
at line 521
Middleware
trustHosts(array|callable|null $at = null, bool $subdomains = true)
Indicate that the trusted host middleware should be enabled.
at line 537
Middleware
trustProxies(array|string|null $at = null, int|null $headers = null)
Configure the trusted proxies for the application.
at line 555
Middleware
preventRequestsDuringMaintenance(array $except = [])
Configure the middleware that prevents requests during maintenance mode.
at line 565
Middleware
statefulApi()
Indicate that Sanctum's frontend state middleware should be enabled.
at line 575
Middleware
throttleApi(string $limiter = 'api')
Indicate that the API middleware group's throttling middleware should be enabled.
at line 588
Middleware
authenticateSessions()
Indicate that sessions should be authenticated for the "web" middleware group.
at line 598
array
getMiddlewareAliases()
Get the middleware aliases.
at line 606
protected array
defaultAliases()
Get the default middleware aliases.
at line 627
array
getMiddlewarePriority()
Get the middleware priority for the application.
at line 635
array
getMiddlewarePriorityPrepends()
Get the middleware to prepend to the middleware priority definition.
at line 643
array
getMiddlewarePriorityAppends()
Get the middleware to append to the middleware priority definition.