Route
class Route (View source)
Traits
Properties
protected string | $uri | The URI pattern the route responds to. | |
protected array | $methods | The HTTP methods the route responds to. | |
protected array | $action | The route action array. | |
protected array | $defaults | The default values for the route. | |
protected array | $wheres | The regular expression requirements. | |
protected array | $parameters | The array of matched parameters. | |
protected array|null | $parameterNames | The parameter names for the route. | |
protected CompiledRoute | $compiled | The compiled version of the route. | |
protected Router | $router | The router instance used by the route. | |
protected Container | $container | The container instance used by the route. | |
static array | $validators | The validators used by the routes. |
Methods
Call a class method with the resolved dependencies.
Resolve the object method's type-hinted dependencies.
Resolve the given method's type-hinted dependencies.
Attempt to transform the given parameter into a class instance.
Determine if an object of the given class is in a list of parameters.
Splice the given value into the parameter list.
Compile the route into a Symfony CompiledRoute instance.
Get the optional parameters for the route.
Get or set the middlewares attached to the route.
Get the controller middleware for the route.
Get the parameters that are listed in the route / controller signature.
Determine if the route has parameters.
Determine a given parameter exists from the route.
Get a given parameter from the route.
Get a given parameter from the route.
Set a parameter to the given value.
Unset a parameter on the route if it is set.
Get the key / value list of parameters for the route.
Get the key / value list of parameters without null values.
Get all of the parameter names for the route.
Get the parameter names for the route.
Extract the parameter list from the host part of the request.
Combine a set of parameter matches with the route's keys.
Replace null parameters with their defaults.
Parse the route action into a standard array.
Find the callable in an action array.
Get the route validators for the instance.
Set a default value for the route.
Set a regular expression requirement on the route.
Parse arguments to the where method into an array.
Set a list of regular expression requirements on the route.
Add a prefix to the route URI.
Get the URI associated with the route.
Get the URI associated with the route.
Get the HTTP verbs the route responds to.
Get the HTTP verbs the route responds to.
Determine if the route only responds to HTTP requests.
Determine if the route only responds to HTTPS requests.
Determine if the route only responds to HTTPS requests.
Get the domain defined for the route.
Get the URI that the route responds to.
Set the URI that the route responds to.
Get the prefix of the route instance.
Get the name of the route instance.
Add or change the route name.
Parse a string based action for the "uses" fluent method.
Get the action name for the route.
Get the action array for the route.
Set the action array for the route.
Get the compiled version of the route.
Prepare the route instance for serialization.
Dynamically access route parameters.
Details
protected mixed
callWithDependencies(object $instance, string $method)
Call a class method with the resolved dependencies.
protected array
resolveClassMethodDependencies(array $parameters, object $instance, string $method)
Resolve the object method's type-hinted dependencies.
array
resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector)
Resolve the given method's type-hinted dependencies.
protected mixed
transformDependency(ReflectionParameter $parameter, array $parameters, array $originalParameters)
Attempt to transform the given parameter into a class instance.
protected bool
alreadyInParameters(string $class, array $parameters)
Determine if an object of the given class is in a list of parameters.
protected void
spliceIntoParameters(array $parameters, string $key, mixed $instance)
Splice the given value into the parameter list.
at line 110
void
__construct(array|string $methods, string $uri, Closure|array $action)
Create a new Route instance.
at line 152
protected mixed
runCallable(Request $request)
Run the route action and return the response.
at line 169
protected mixed
runController(Request $request)
Run the route action and return the response.
at line 184
bool
matches(Request $request, bool $includingMethod = true)
Determine if the route matches given request.
at line 206
protected void
compileRoute()
Compile the route into a Symfony CompiledRoute instance.
at line 222
protected array
extractOptionalParameters()
Get the optional parameters for the route.
at line 235
$this|array
middleware(array|string|null $middleware = null)
Get or set the middlewares attached to the route.
at line 257
protected array
controllerMiddleware()
Get the controller middleware for the route.
at line 273
array
signatureParameters(string|null $subClass = null)
Get the parameters that are listed in the route / controller signature.
at line 295
bool
hasParameters()
Determine if the route has parameters.
at line 306
bool
hasParameter(string $name)
Determine a given parameter exists from the route.
at line 322
string|object
getParameter(string $name, mixed $default = null)
Get a given parameter from the route.
at line 334
string|object
parameter(string $name, mixed $default = null)
Get a given parameter from the route.
at line 346
void
setParameter(string $name, mixed $value)
Set a parameter to the given value.
at line 359
void
forgetParameter(string $name)
Unset a parameter on the route if it is set.
at line 373
array
parameters()
Get the key / value list of parameters for the route.
at line 387
array
parametersWithoutNulls()
Get the key / value list of parameters without null values.
at line 399
array
parameterNames()
Get all of the parameter names for the route.
at line 413
protected array
compileParameterNames()
Get the parameter names for the route.
at line 470
protected array
bindPathParameters(Request $request)
Get the parameter matches for the path portion of the URI.
at line 484
protected array
bindHostParameters(Request $request, array $parameters)
Extract the parameter list from the host part of the request.
at line 497
protected array
matchToKeys(array $matches)
Combine a set of parameter matches with the route's keys.
at line 516
protected array
replaceDefaults(array $parameters)
Replace null parameters with their defaults.
at line 539
protected array
parseAction(callable|array|null $action)
Parse the route action into a standard array.
at line 579
protected callable
findCallable(array $action)
Find the callable in an action array.
at line 591
static array
getValidators()
Get the route validators for the instance.
at line 613
$this
defaults(string $key, mixed $value)
Set a default value for the route.
at line 627
$this
where(array|string $name, string $expression = null)
Set a regular expression requirement on the route.
at line 643
protected array
parseWhere(array|string $name, string $expression)
Parse arguments to the where method into an array.
at line 654
protected $this
whereArray(array $wheres)
Set a list of regular expression requirements on the route.
at line 669
$this
prefix(string $prefix)
Add a prefix to the route URI.
at line 683
string
getPath()
Get the URI associated with the route.
at line 693
string
uri()
Get the URI associated with the route.
at line 703
array
getMethods()
Get the HTTP verbs the route responds to.
at line 713
array
methods()
Get the HTTP verbs the route responds to.
at line 723
bool
httpOnly()
Determine if the route only responds to HTTP requests.
at line 733
bool
httpsOnly()
Determine if the route only responds to HTTPS requests.
at line 743
bool
secure()
Determine if the route only responds to HTTPS requests.
at line 753
string|null
domain()
Get the domain defined for the route.
at line 763
string
getUri()
Get the URI that the route responds to.
at line 774
$this
setUri(string $uri)
Set the URI that the route responds to.
at line 786
string
getPrefix()
Get the prefix of the route instance.
at line 796
string
getName()
Get the name of the route instance.
at line 807
$this
name(string $name)
Add or change the route name.
at line 836
protected string
addGroupNamespaceToStringUses(string $action)
Parse a string based action for the "uses" fluent method.
at line 852
string
getActionName()
Get the action name for the route.
at line 862
array
getAction()
Get the action array for the route.
at line 873
$this
setAction(array $action)
Set the action array for the route.
at line 885
CompiledRoute
getCompiled()
Get the compiled version of the route.
at line 923
void
prepareForSerialization()
Prepare the route instance for serialization.
at line 938
mixed
__get(string $key)
Dynamically access route parameters.