class RouteCollectionBuilder
Helps add and import routes into a RouteCollection.
__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 option 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. |
LoaderInterface | $loader |
Import an external routing resource and returns the RouteCollectionBuilder.
$routes->import('blog.yml', '/blog');
mixed | $resource | |
string|null | $prefix | |
string | $type |
RouteCollectionBuilder |
FileLoaderLoadException |
Adds a route and returns it for future modification.
string | $path | The route path |
string | $controller | The route's controller |
string|null | $name | The name to give this route |
Route |
Returns a RouteCollectionBuilder that can be configured and then added with mount().
RouteCollectionBuilder |
Add a RouteCollectionBuilder.
string | $prefix | |
RouteCollectionBuilder | $builder |
Adds a Route object to the builder.
Route | $route | |
string|null | $name |
$this |
Sets the host on all embedded routes (unless already set).
string | $pattern |
$this |
Sets a condition on all embedded routes (unless already set).
string | $condition |
$this |
Sets a default value that will be added to all embedded routes (unless that default value is already set).
string | $key | |
mixed | $value |
$this |
Sets a requirement that will be added to all embedded routes (unless that requirement is already set).
string | $key | |
mixed | $regex |
$this |
Sets an option that will be added to all embedded routes (unless that option is already set).
string | $key | |
mixed | $value |
$this |
Sets the schemes on all embedded routes (unless already set).
array|string | $schemes |
$this |
Sets the methods on all embedded routes (unless already set).
array|string | $methods |
$this |
Creates the final RouteCollection and returns it.
RouteCollection |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Routing/RouteCollectionBuilder.html