Skip to content

Commit fc8c7fd

Browse files
committed
subpath routing
1 parent 3cc7a12 commit fc8c7fd

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

in-depth_documentation/routing.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,27 @@ If you need more flexibility you can use regular expressions for your route defi
7272
return [
7373
'|^trader/(.*)/$|' => 'MyVendor\\MyApp\\Controller\\TraderController',
7474
'|^ajax/(.*)$|' => 'MyVendor\\MyApp\\Controller\\AjaxController',
75-
'||' => 'MyVendor\\MyApp\\Controller\\IndexHandler',
75+
'||' => 'MyVendor\\MyApp\\Controller\\IndexController',
7676
];
7777

7878
The strings *matched* by the paranthesis of the regular expressions will be passed to the Controller as `$params`.
7979

80+
### subpath routing
81+
82+
If you have several routes starting with the same prefix you can group the in a subpath:
83+
84+
`routes.php`:
85+
86+
<?php
87+
88+
return [
89+
'profile/%' => [
90+
'.' => 'MyVendor\\MyApp\\Controller\\ProfileSummaryController',
91+
'edit/' => 'MyVendor\\MyApp\\Controller\\ProfileEditController',
92+
]
93+
];
94+
95+
You can nest subpaths with no limit and you can use parameters on each level.
8096

8197
### callable routing
8298

0 commit comments

Comments
 (0)