Documentation

Route
in package
Uses Macroable, RouteDependencyResolverTrait

Table of Contents

$action  : array<string|int, mixed>
The route action array.
$compiled  : CompiledRoute
The compiled version of the route.
$computedMiddleware  : array<string|int, mixed>|null
The computed gathered middleware.
$controller  : mixed
The controller instance.
$defaults  : array<string|int, mixed>
The default values for the route.
$isFallback  : bool
Indicates whether the route is a fallback route.
$methods  : array<string|int, mixed>
The HTTP methods the route responds to.
$parameterNames  : array<string|int, mixed>|null
The parameter names for the route.
$parameters  : array<string|int, mixed>
The array of matched parameters.
$uri  : string
The URI pattern the route responds to.
$validators  : array<string|int, mixed>
The validators used by the routes.
$wheres  : array<string|int, mixed>
The regular expression requirements.
$container  : Container
The container instance used by the route.
$macros  : array<string|int, mixed>
The registered string macros.
$router  : Router
The router instance used by the route.
__call()  : mixed
Dynamically handle calls to the class.
__callStatic()  : mixed
Dynamically handle calls to the class.
__construct()  : void
Create a new Route instance.
__get()  : mixed
Dynamically access route parameters.
bind()  : $this
Bind the route to a given request for execution.
controllerDispatcher()  : ControllerDispatcher
Get the dispatcher for the route's controller.
controllerMiddleware()  : array<string|int, mixed>
Get the middleware for the route's controller.
defaults()  : $this
Set a default value for the route.
domain()  : $this|string|null
Get or set the domain for the route.
fallback()  : $this
Mark this route as a fallback route.
forgetParameter()  : void
Unset a parameter on the route if it is set.
gatherMiddleware()  : array<string|int, mixed>
Get all middleware, including the ones from the controller.
getAction()  : mixed
Get the action array or one of its properties for the route.
getActionMethod()  : string
Get the method name of the route action.
getActionName()  : string
Get the action name for the route.
getCompiled()  : CompiledRoute
Get the compiled version of the route.
getController()  : mixed
Get the controller instance for the route.
getDomain()  : string|null
Get the domain defined for the route.
getName()  : string
Get the name of the route instance.
getPrefix()  : string
Get the prefix of the route instance.
getValidators()  : array<string|int, mixed>
Get the route validators for the instance.
hasMacro()  : bool
Checks if macro is registered.
hasParameter()  : bool
Determine a given parameter exists from the route.
hasParameters()  : bool
Determine if the route has parameters.
httpOnly()  : bool
Determine if the route only responds to HTTP requests.
httpsOnly()  : bool
Determine if the route only responds to HTTPS requests.
macro()  : void
Register a custom macro.
matches()  : bool
Determine if the route matches given request.
methods()  : array<string|int, mixed>
Get the HTTP verbs the route responds to.
middleware()  : $this|array<string|int, mixed>
Get or set the middlewares attached to the route.
mixin()  : void
Mix another object into the class.
name()  : $this
Add or change the route name.
named()  : bool
Determine whether the route's name matches the given patterns.
parameter()  : string|object
Get a given parameter from the route.
parameterNames()  : array<string|int, mixed>
Get all of the parameter names for the route.
parameters()  : array<string|int, mixed>
Get the key / value list of parameters for the route.
parametersWithoutNulls()  : array<string|int, mixed>
Get the key / value list of parameters without null values.
prefix()  : $this
Add a prefix to the route URI.
prepareForSerialization()  : void
Prepare the route instance for serialization.
resolveMethodDependencies()  : array<string|int, mixed>
Resolve the given method's type-hinted dependencies.
run()  : mixed
Run the route action and return the response.
secure()  : bool
Determine if the route only responds to HTTPS requests.
setAction()  : $this
Set the action array for the route.
setContainer()  : $this
Set the container instance on the route.
setParameter()  : void
Set a parameter to the given value.
setRouter()  : $this
Set the router instance on the route.
setUri()  : $this
Set the URI that the route responds to.
signatureParameters()  : array<string|int, mixed>
Get the parameters that are listed in the route / controller signature.
uri()  : string
Get the URI associated with the route.
uses()  : $this
Set the handler for the route.
where()  : $this
Set a regular expression requirement on the route.
addGroupNamespaceToStringUses()  : string
Parse a string based action for the "uses" fluent method.
alreadyInParameters()  : bool
Determine if an object of the given class is in a list of parameters.
compileParameterNames()  : array<string|int, mixed>
Get the parameter names for the route.
compileRoute()  : CompiledRoute
Compile the route into a Symfony CompiledRoute instance.
getControllerMethod()  : string
Get the controller method used for the route.
isControllerAction()  : bool
Checks whether the route's action is a controller.
parseAction()  : array<string|int, mixed>
Parse the route action into a standard array.
parseControllerCallback()  : array<string|int, mixed>
Parse the controller.
parseWhere()  : array<string|int, mixed>
Parse arguments to the where method into an array.
resolveClassMethodDependencies()  : array<string|int, mixed>
Resolve the object method's type-hinted dependencies.
runCallable()  : mixed
Run the route action and return the response.
runController()  : mixed
Run the route action and return the response.
spliceIntoParameters()  : void
Splice the given value into the parameter list.
transformDependency()  : mixed
Attempt to transform the given parameter into a class instance.
whereArray()  : $this
Set a list of regular expression requirements on the route.

Properties

$action

The route action array.

public array<string|int, mixed> $action

$computedMiddleware

The computed gathered middleware.

public array<string|int, mixed>|null $computedMiddleware

$controller

The controller instance.

public mixed $controller

$defaults

The default values for the route.

public array<string|int, mixed> $defaults = []

$isFallback

Indicates whether the route is a fallback route.

public bool $isFallback = false

$methods

The HTTP methods the route responds to.

public array<string|int, mixed> $methods

$parameterNames

The parameter names for the route.

public array<string|int, mixed>|null $parameterNames

$parameters

The array of matched parameters.

public array<string|int, mixed> $parameters

$uri

The URI pattern the route responds to.

public string $uri

$validators

The validators used by the routes.

public static array<string|int, mixed> $validators

$wheres

The regular expression requirements.

public array<string|int, mixed> $wheres = []

$container

The container instance used by the route.

protected Container $container

$macros

The registered string macros.

protected static array<string|int, mixed> $macros = []

$router

The router instance used by the route.

protected Router $router

Methods

__call()

Dynamically handle calls to the class.

public __call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string
$parameters : array<string|int, mixed>
Tags
throws
BadMethodCallException
Return values
mixed

__callStatic()

Dynamically handle calls to the class.

public static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string
$parameters : array<string|int, mixed>
Tags
throws
BadMethodCallException
Return values
mixed

__construct()

Create a new Route instance.

public __construct(array<string|int, mixed>|string $methods, string $uri, Closure|array<string|int, mixed> $action) : void
Parameters
$methods : array<string|int, mixed>|string
$uri : string
$action : Closure|array<string|int, mixed>
Return values
void

__get()

Dynamically access route parameters.

public __get(string $key) : mixed
Parameters
$key : string
Return values
mixed

bind()

Bind the route to a given request for execution.

public bind(Request $request) : $this
Parameters
$request : Request
Return values
$this

controllerMiddleware()

Get the middleware for the route's controller.

public controllerMiddleware() : array<string|int, mixed>
Return values
array<string|int, mixed>

defaults()

Set a default value for the route.

public defaults(string $key, mixed $value) : $this
Parameters
$key : string
$value : mixed
Return values
$this

domain()

Get or set the domain for the route.

public domain([string|null $domain = null ]) : $this|string|null
Parameters
$domain : string|null = null
Return values
$this|string|null

fallback()

Mark this route as a fallback route.

public fallback() : $this
Return values
$this

forgetParameter()

Unset a parameter on the route if it is set.

public forgetParameter(string $name) : void
Parameters
$name : string
Return values
void

gatherMiddleware()

Get all middleware, including the ones from the controller.

public gatherMiddleware() : array<string|int, mixed>
Return values
array<string|int, mixed>

getAction()

Get the action array or one of its properties for the route.

public getAction([string|null $key = null ]) : mixed
Parameters
$key : string|null = null
Return values
mixed

getActionMethod()

Get the method name of the route action.

public getActionMethod() : string
Return values
string

getActionName()

Get the action name for the route.

public getActionName() : string
Return values
string

getController()

Get the controller instance for the route.

public getController() : mixed
Return values
mixed

getDomain()

Get the domain defined for the route.

public getDomain() : string|null
Return values
string|null

getName()

Get the name of the route instance.

public getName() : string
Return values
string

getPrefix()

Get the prefix of the route instance.

public getPrefix() : string
Return values
string

getValidators()

Get the route validators for the instance.

public static getValidators() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasMacro()

Checks if macro is registered.

public static hasMacro(string $name) : bool
Parameters
$name : string
Return values
bool

hasParameter()

Determine a given parameter exists from the route.

public hasParameter(string $name) : bool
Parameters
$name : string
Return values
bool

hasParameters()

Determine if the route has parameters.

public hasParameters() : bool
Return values
bool

httpOnly()

Determine if the route only responds to HTTP requests.

public httpOnly() : bool
Return values
bool

httpsOnly()

Determine if the route only responds to HTTPS requests.

public httpsOnly() : bool
Return values
bool

macro()

Register a custom macro.

public static macro(string $name, object|callable $macro) : void
Parameters
$name : string
$macro : object|callable
Return values
void

matches()

Determine if the route matches given request.

public matches(Request $request[, bool $includingMethod = true ]) : bool
Parameters
$request : Request
$includingMethod : bool = true
Return values
bool

methods()

Get the HTTP verbs the route responds to.

public methods() : array<string|int, mixed>
Return values
array<string|int, mixed>

middleware()

Get or set the middlewares attached to the route.

public middleware([array<string|int, mixed>|string|null $middleware = null ]) : $this|array<string|int, mixed>
Parameters
$middleware : array<string|int, mixed>|string|null = null
Return values
$this|array<string|int, mixed>

mixin()

Mix another object into the class.

public static mixin(object $mixin) : void
Parameters
$mixin : object
Return values
void

name()

Add or change the route name.

public name(string $name) : $this
Parameters
$name : string
Return values
$this

named()

Determine whether the route's name matches the given patterns.

public named(dynamic ...$patterns) : bool
Parameters
$patterns : dynamic
Return values
bool

parameter()

Get a given parameter from the route.

public parameter(string $name[, mixed $default = null ]) : string|object
Parameters
$name : string
$default : mixed = null
Return values
string|object

parameterNames()

Get all of the parameter names for the route.

public parameterNames() : array<string|int, mixed>
Return values
array<string|int, mixed>

parameters()

Get the key / value list of parameters for the route.

public parameters() : array<string|int, mixed>
Tags
throws
LogicException
Return values
array<string|int, mixed>

parametersWithoutNulls()

Get the key / value list of parameters without null values.

public parametersWithoutNulls() : array<string|int, mixed>
Return values
array<string|int, mixed>

prefix()

Add a prefix to the route URI.

public prefix(string $prefix) : $this
Parameters
$prefix : string
Return values
$this

prepareForSerialization()

Prepare the route instance for serialization.

public prepareForSerialization() : void
Tags
throws
LogicException
Return values
void

resolveMethodDependencies()

Resolve the given method's type-hinted dependencies.

public resolveMethodDependencies(array<string|int, mixed> $parameters, ReflectionFunctionAbstract $reflector) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
$reflector : ReflectionFunctionAbstract
Return values
array<string|int, mixed>

run()

Run the route action and return the response.

public run() : mixed
Return values
mixed

secure()

Determine if the route only responds to HTTPS requests.

public secure() : bool
Return values
bool

setAction()

Set the action array for the route.

public setAction(array<string|int, mixed> $action) : $this
Parameters
$action : array<string|int, mixed>
Return values
$this

setContainer()

Set the container instance on the route.

public setContainer(Container $container) : $this
Parameters
$container : Container
Return values
$this

setParameter()

Set a parameter to the given value.

public setParameter(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed
Return values
void

setRouter()

Set the router instance on the route.

public setRouter(Router $router) : $this
Parameters
$router : Router
Return values
$this

setUri()

Set the URI that the route responds to.

public setUri(string $uri) : $this
Parameters
$uri : string
Return values
$this

signatureParameters()

Get the parameters that are listed in the route / controller signature.

public signatureParameters([string|null $subClass = null ]) : array<string|int, mixed>
Parameters
$subClass : string|null = null
Return values
array<string|int, mixed>

uri()

Get the URI associated with the route.

public uri() : string
Return values
string

uses()

Set the handler for the route.

public uses(Closure|string $action) : $this
Parameters
$action : Closure|string
Return values
$this

where()

Set a regular expression requirement on the route.

public where(array<string|int, mixed>|string $name[, string $expression = null ]) : $this
Parameters
$name : array<string|int, mixed>|string
$expression : string = null
Return values
$this

addGroupNamespaceToStringUses()

Parse a string based action for the "uses" fluent method.

protected addGroupNamespaceToStringUses(string $action) : string
Parameters
$action : string
Return values
string

alreadyInParameters()

Determine if an object of the given class is in a list of parameters.

protected alreadyInParameters(string $class, array<string|int, mixed> $parameters) : bool
Parameters
$class : string
$parameters : array<string|int, mixed>
Return values
bool

compileParameterNames()

Get the parameter names for the route.

protected compileParameterNames() : array<string|int, mixed>
Return values
array<string|int, mixed>

getControllerMethod()

Get the controller method used for the route.

protected getControllerMethod() : string
Return values
string

isControllerAction()

Checks whether the route's action is a controller.

protected isControllerAction() : bool
Return values
bool

parseAction()

Parse the route action into a standard array.

protected parseAction(callable|array<string|int, mixed>|null $action) : array<string|int, mixed>
Parameters
$action : callable|array<string|int, mixed>|null
Tags
throws
UnexpectedValueException
Return values
array<string|int, mixed>

parseControllerCallback()

Parse the controller.

protected parseControllerCallback() : array<string|int, mixed>
Return values
array<string|int, mixed>

parseWhere()

Parse arguments to the where method into an array.

protected parseWhere(array<string|int, mixed>|string $name, string $expression) : array<string|int, mixed>
Parameters
$name : array<string|int, mixed>|string
$expression : string
Return values
array<string|int, mixed>

resolveClassMethodDependencies()

Resolve the object method's type-hinted dependencies.

protected resolveClassMethodDependencies(array<string|int, mixed> $parameters, object $instance, string $method) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
$instance : object
$method : string
Return values
array<string|int, mixed>

runCallable()

Run the route action and return the response.

protected runCallable() : mixed
Return values
mixed

runController()

Run the route action and return the response.

protected runController() : mixed
Tags
throws
NotFoundHttpException
Return values
mixed

spliceIntoParameters()

Splice the given value into the parameter list.

protected spliceIntoParameters(array<string|int, mixed> &$parameters, string $offset, mixed $value) : void
Parameters
$parameters : array<string|int, mixed>
$offset : string
$value : mixed
Return values
void

transformDependency()

Attempt to transform the given parameter into a class instance.

protected transformDependency(ReflectionParameter $parameter, array<string|int, mixed> $parameters) : mixed
Parameters
$parameter : ReflectionParameter
$parameters : array<string|int, mixed>
Return values
mixed

whereArray()

Set a list of regular expression requirements on the route.

protected whereArray(array<string|int, mixed> $wheres) : $this
Parameters
$wheres : array<string|int, mixed>
Return values
$this

Search results