Route
class Route
Traits
Properties
string | $uri | The URI pattern the route responds to. |
|
array | $methods | The HTTP methods the route responds to. |
|
array | $action | The route action array. |
|
mixed | $controller | The controller instance. |
|
array | $defaults | The default values for the route. |
|
array | $wheres | The regular expression requirements. |
|
array | $parameters | The array of matched parameters. |
|
array|null | $parameterNames | The parameter names for the route. |
|
array|null | $computedMiddleware | The computed gathered middleware. |
|
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
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.
Parse the route action into a standard array.
Run the route action and return the response.
Checks whether the route's action is a controller.
Run the route action and return the response.
Run the route action and return the response.
Get the controller instance for the route.
Get the controller method used for the route.
Parse the controller.
Compile the route into a Symfony CompiledRoute instance.
Determine if the route has parameters.
Determine a given parameter exists 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.
Get the parameters that are listed in the route / controller signature.
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.
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 prefix of the route instance.
Add a prefix to the route URI.
Get the URI associated with the route.
Set the URI that the route responds to.
Get the name of the route instance.
Add or change the route name.
Determine whether the route's name matches the given name.
Parse a string based action for the "uses" fluent method.
Get the action name for the route.
Get the method name of the route action.
Get the action array for the route.
Set the action array for the route.
Get all middleware, including the ones from the controller.
Get or set the middlewares attached to the route.
Get the middleware for the route's controller.
Get the route validators for the instance.
Get the compiled version of the route.
Prepare the route instance for serialization.
Dynamically access route parameters.
Details
in
RouteDependencyResolverTrait at line 20
protected array
resolveClassMethodDependencies(array $parameters, object $instance, string $method)
Resolve the object method's type-hinted dependencies.
in
RouteDependencyResolverTrait at line 38
array
resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector)
Resolve the given method's type-hinted dependencies.
in
RouteDependencyResolverTrait at line 69
protected mixed
transformDependency(ReflectionParameter $parameter, array $parameters)
Attempt to transform the given parameter into a class instance.
in
RouteDependencyResolverTrait at line 88
protected bool
alreadyInParameters(string $class, array $parameters)
Determine if an object of the given class is in a list of parameters.
in
RouteDependencyResolverTrait at line 103
protected void
spliceIntoParameters(array $parameters, string $offset, mixed $value)
Splice the given value into the parameter list.
at line 121
void
__construct(array|string $methods, string $uri, Closure|array $action)
Create a new Route instance.
at line 144
protected array
parseAction(callable|array|null $action)
Parse the route action into a standard array.
at line 154
mixed
run()
Run the route action and return the response.
at line 174
protected bool
isControllerAction()
Checks whether the route's action is a controller.
at line 184
protected mixed
runCallable()
Run the route action and return the response.
at line 200
protected mixed
runController()
Run the route action and return the response.
at line 212
mixed
getController()
Get the controller instance for the route.
at line 228
protected string
getControllerMethod()
Get the controller method used for the route.
at line 238
protected array
parseControllerCallback()
Parse the controller.
at line 250
bool
matches(Request $request, bool $includingMethod = true)
Determine if the route matches given request.
at line 272
protected void
compileRoute()
Compile the route into a Symfony CompiledRoute instance.
at line 287
$this
bind(Request $request)
Bind the route to a given request for execution.
at line 302
bool
hasParameters()
Determine if the route has parameters.
at line 313
bool
hasParameter(string $name)
Determine a given parameter exists from the route.
at line 329
string|object
parameter(string $name, mixed $default = null)
Get a given parameter from the route.
at line 341
void
setParameter(string $name, mixed $value)
Set a parameter to the given value.
at line 354
void
forgetParameter(string $name)
Unset a parameter on the route if it is set.
at line 368
array
parameters()
Get the key / value list of parameters for the route.
at line 382
array
parametersWithoutNulls()
Get the key / value list of parameters without null values.
at line 394
array
parameterNames()
Get all of the parameter names for the route.
at line 408
protected array
compileParameterNames()
Get the parameter names for the route.
at line 423
array
signatureParameters(string|null $subClass = null)
Get the parameters that are listed in the route / controller signature.
at line 435
$this
defaults(string $key, mixed $value)
Set a default value for the route.
at line 449
$this
where(array|string $name, string $expression = null)
Set a regular expression requirement on the route.
at line 465
protected array
parseWhere(array|string $name, string $expression)
Parse arguments to the where method into an array.
at line 476
protected $this
whereArray(array $wheres)
Set a list of regular expression requirements on the route.
at line 490
array
methods()
Get the HTTP verbs the route responds to.
at line 500
bool
httpOnly()
Determine if the route only responds to HTTP requests.
at line 510
bool
httpsOnly()
Determine if the route only responds to HTTPS requests.
at line 520
bool
secure()
Determine if the route only responds to HTTPS requests.
at line 530
string|null
domain()
Get the domain defined for the route.
at line 541
string
getPrefix()
Get the prefix of the route instance.
at line 552
$this
prefix(string $prefix)
Add a prefix to the route URI.
at line 566
string
uri()
Get the URI associated with the route.
at line 577
$this
setUri(string $uri)
Set the URI that the route responds to.
at line 589
string
getName()
Get the name of the route instance.
at line 600
$this
name(string $name)
Add or change the route name.
at line 613
bool
named(string $name)
Determine whether the route's name matches the given name.
at line 624
$this
uses(Closure|string $action)
Set the handler for the route.
at line 640
protected string
addGroupNamespaceToStringUses(string $action)
Parse a string based action for the "uses" fluent method.
at line 656
string
getActionName()
Get the action name for the route.
at line 666
string
getActionMethod()
Get the method name of the route action.
at line 676
array
getAction()
Get the action array for the route.
at line 687
$this
setAction(array $action)
Set the action array for the route.
at line 699
array
gatherMiddleware()
Get all middleware, including the ones from the controller.
at line 718
$this|array
middleware(array|string|null $middleware = null)
Get or set the middlewares attached to the route.
at line 740
array
controllerMiddleware()
Get the middleware for the route's controller.
at line 756
static array
getValidators()
Get the route validators for the instance.
at line 776
CompiledRoute
getCompiled()
Get the compiled version of the route.
at line 787
$this
setRouter(Router $router)
Set the router instance on the route.
at line 800
$this
setContainer(Container $container)
Set the container instance on the route.
at line 814
void
prepareForSerialization()
Prepare the route instance for serialization.
at line 831
mixed
__get(string $key)
Dynamically access route parameters.