На Phalcon я использовал такой метод, что бы собрать названия контроллеров и экшенов -
const EXCLUDED_CONTROLLERS = [
'user',
'acl',
'resources',
'roles',
'users'
];
const EXCLUDED_ACTIONS = [
'login',
'logout'
];
/**
* Get available resources list
*/
public function getAvailableResources(): array
{
$resources = [];
$resources['*'][] = '*';
$controllersPaths = [
'/app/controllers/',
];
foreach ($controllersPaths as $path) {
foreach (glob(BASE_PATH . $path .'/*Controller.php') as $controller) {
$className = basename($controller, '.php');
$class = strtolower(str_replace('Controller', '', basename($controller, '.php')));
if (in_array($class, self::EXCLUDED_CONTROLLERS)) {
continue;
}
$resources[$class] = [];
$methods = (new \ReflectionClass($className))->getMethods(\ReflectionMethod::IS_PUBLIC);
foreach ($methods as $method) {
if (\Phalcon\Text::endsWith($method->name, 'Action')) {
$action = strtolower(str_replace('Action', '', $method->name));
if (in_array($action, self::EXCLUDED_ACTIONS)) {
continue;
}
$resources[$class][] = $action;
}
}
}
}
return $resources;
}
Немного работы напильником, и заработает на Laravel