This repository has been archived by the owner. It is now read-only.
A simple CakePHP component which returns a list of controllers
Switch branches/tags
Clone or download
Failed to load latest commit information.
app/Controller/Component Adding support for plugin controllers (#4) Jan 10, 2016

ControllerList component for CakePHP


A simple component for CakePHP 2.x which returns a list of controllers and the corresponding action names.


Requires at least PHP 5.3.


Copy the file app/Controller/Component/ControllerListComponent.php to the Controller/Component folder of your application.


First, you have to add the component to the $components array of your controller(s):

public $components = array('ControllerList');

Then you can use the component in your action(s) with: $this->ControllerList->getList(). You can also specify the controllers which should be excluded from the returned list: $this->ControllerList->getList(array('UsersController')). Please note that without this parameter, the PagesController is automatically excluded.

The structure of the returned array is like:

  'ExampleController' => array(
    'name' => 'Example',
    'displayName' => 'Example',
    'actions' => array(
      (int) 0 => 'index',
      (int) 1 => 'show'
  'VendorExampleController' => array(
    'name' => 'VendorExample',
    'displayName' => 'Vendor Example',
    'actions' => array(
      (int) 0 => 'index',
      (int) 1 => 'callback',
      (int) 2 => 'api'


The component provides two configuration options.

The first option, includePlugins, determines whether controllers in plugins are listed. By default, those controllers are ignored.

public $components = array('ControllerList' => array('includePlugins' => true));

The second option, parentControllers, allows you to specify parent controllers other than AppController.

public $components = array('ControllerList' => array('parentControllers' => array('ParentController')));


v2.0.2 (2016-01-11)

  • Added the configuration option includePlugins. Thanks to Oscar!

v2.0.1 (2015-11-18)

  • Added the configuration option parentControllers. Thanks to leodisarli!

v2.0.0 (2012-07-30)

  • Added parameter $controllersToExclude to the getList() method
  • Changed the structure of the returned array by including the keys name, displayName and actions. Thanks to Charles A. Beasley!

v1.0.0 (2012-01-29)


  • Initial release


If you have questions or feedback, feel free to contact me via Twitter (@dhofstet) or by email (


The ControllerList component is licensed under the MIT license.