$route = new \Phroute\RouteCollector(); $route->get('/users', function() { return (new UserController())->index(); }); $controller = $route->getController('/users'); // returns 'UserController'
$route = new \Phroute\RouteCollector(); $route->group(['namespace' => 'App\Controllers'], function($route) { $route->get('/users', 'UserController@index'); }); $controller = $route->getController('/users'); // returns 'App\Controllers\UserController'This example defines a group of routes for controllers in the `App\Controllers` namespace. The `UserController` is defined with the `index` method. Again, the `getController` function is used to retrieve the name of the controller, which is `App\Controllers\UserController`. In both examples, the PHP Route package library is used to define routes and retrieve the name of the controller for the current route.