Skip to content

Commit 18dc1a7

Browse files
committed
Routing: syntactic sugar in PHP 5.5
1 parent fc8c7fd commit 18dc1a7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

in-depth_documentation/routing.md

+12
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,15 @@ Instead of providing a controller class name, you can also directly provide a [c
104104
return [
105105
'is/phpframework/awesome/' => function() { return 'yes!' },
106106
];
107+
108+
### PHP 5.5 syntax sugar
109+
110+
If you use PHP 5.5 or higher you are encouraged to use the sweet new `::class` constant for the classnames. This will provide you with autocompletion in your IDE.
111+
112+
`myapp/routes.php`:
113+
114+
<?php
115+
return [
116+
'users/' => MyVendor\MyApp\Controller\UserListController::class,
117+
'.' => MyVendor\MyApp\Controller\IndexController::class,
118+
];

0 commit comments

Comments
 (0)