I know this is old, but I wanted to do this tonight and stumbled upon this thread. This code worked for me (basically an implementation of the steps suggested by Burak):
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Controllers extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function index()
{
$controllers = array();
$dir = APPPATH.'/controllers/';
$files = scandir($dir);
$controller_files = array_filter($files, function($filename) {
return (substr(strrchr($filename, '.'), 1)=='php') ? true : false;
});
foreach ($controller_files as $filename)
{
require_once('./application/controllers/'.$filename);
$classname = ucfirst(substr($filename, 0, strrpos($filename, '.')));
$controller = new $classname();
$methods = get_class_methods($controller);
foreach ($methods as $method)
{
array_push($methods,$method);
}
$controller_info = array(
'filename' => $filename,
'class_name' => $classname,
'methods' => $methods
);
array_push($controllers,$controller_info);
}
echo('<pre>');
print_r($controllers);
echo('</pre>');
}
}
/* End of file controllers.php */
/* Location: ./application/controllers/controllers.php */
If you wanted, you could classify the methods as public, private or static by following the example in this comment: http://www.php.net/manual/en/function.method-exists.php#94112