get all controllers in controllers folder

Is there a function that returns all the controllers present in protected/controllers folders.

I need all the controller ids.

For Ex:

for SiteController it should return site

for UserController it should return user


nope, there is not.

Properly designed site should never need it.

Anyway, you can easily get list of all controllers like this:

$controllers = array();

$files = CFileHelper::findFiles(realpath(Yii::app()->basePath . DIRECTORY_SEPARATOR . 'controllers'));

foreach($files as $file){

	$filename = basename($file, '.php');

	if( ($pos = strpos($filename, 'Controller')) > 0){

		$controllers[] = substr($filename, 0, $pos);