Correct me if I am not wrong. You want to fetch all methods of given class and/or all classes along with their methods in given controller directory.
This way you will be having all available routes for the application/controllers/User.php say
You can achieve the same by doing as follow.
You can use Codeigniter Library named List.php from source code at Gist here
You can use this library to list all controllers and methods.
Usage
You can fetch controllers list as below
function index()
{
// Fetch list of controllers
$endpoints = array_keys($this->lists->getControllers());
print_r($endpoints);
}
You can fetch list of methods inside any given controllers as below:
function list_routes($endpoint='')
{
if($endpoint=='')
{
die('Error');
}
$endpoint = ucfirst($endpoint);
$methods = $this->lists->getControllers();
print_r($methods);
}
If you want to change the default folder from /controllers/ to anything else, you can either modify List.php function to extend and pass the dynamic parameter to setControllers function at
foreach(glob(APPPATH . 'YOUR_FOLDER_HERE') as $controller) {
###
}
I am using the Above solution to fetch and automate some API documentation where I fetch all endpoints and routes along with comments to display in our developer panel.
Please feel free to reach me if having any doubts or question regarding the same.