class RouteCollectionBuilder
Helps add and import routes into a RouteCollection.
Methods
__construct(LoaderInterface $loader = null) | ||
RouteCollectionBuilder | import(mixed $resource, string|null $prefix = '/', string $type = null) Import an external routing resource and returns the RouteCollectionBuilder. | |
Route | add(string $path, string $controller, string|null $name = null) Adds a route and returns it for future modification. | |
RouteCollectionBuilder | createBuilder() Returns a RouteCollectionBuilder that can be configured and then added with mount(). | |
mount(string $prefix, RouteCollectionBuilder $builder) Add a RouteCollectionBuilder. | ||
$this | addRoute(Route $route, string|null $name = null) Adds a Route object to the builder. | |
$this | setHost(string $pattern) Sets the host on all embedded routes (unless already set). | |
$this | setCondition(string $condition) Sets a condition on all embedded routes (unless already set). | |
$this | setDefault(string $key, mixed $value) Sets a default value that will be added to all embedded routes (unless that default value is already set). | |
$this | setRequirement(string $key, mixed $regex) Sets a requirement that will be added to all embedded routes (unless that requirement is already set). | |
$this | setOption(string $key, mixed $value) Sets an opiton that will be added to all embedded routes (unless that option is already set). | |
$this | setSchemes(array|string $schemes) Sets the schemes on all embedded routes (unless already set). | |
$this | setMethods(array|string $methods) Sets the methods on all embedded routes (unless already set). | |
RouteCollection | build() Creates the final RouteCollection and returns it. |
Details
__construct(LoaderInterface $loader = null)
RouteCollectionBuilder import(mixed $resource, string|null $prefix = '/', string $type = null)
Import an external routing resource and returns the RouteCollectionBuilder.
$routes->import('blog.yml', '/blog');
Route add(string $path, string $controller, string|null $name = null)
Adds a route and returns it for future modification.
RouteCollectionBuilder createBuilder()
Returns a RouteCollectionBuilder that can be configured and then added with mount().
mount(string $prefix, RouteCollectionBuilder $builder)
Add a RouteCollectionBuilder.
$this addRoute(Route $route, string|null $name = null)
Adds a Route object to the builder.
$this setHost(string $pattern)
Sets the host on all embedded routes (unless already set).
$this setCondition(string $condition)
Sets a condition on all embedded routes (unless already set).
$this setDefault(string $key, mixed $value)
Sets a default value that will be added to all embedded routes (unless that default value is already set).
$this setRequirement(string $key, mixed $regex)
Sets a requirement that will be added to all embedded routes (unless that requirement is already set).
$this setOption(string $key, mixed $value)
Sets an opiton that will be added to all embedded routes (unless that option is already set).
$this setSchemes(array|string $schemes)
Sets the schemes on all embedded routes (unless already set).
$this setMethods(array|string $methods)
Sets the methods on all embedded routes (unless already set).
RouteCollection build()
Creates the final RouteCollection and returns it.
Please login to continue.