Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Get all controllers and actions
  • Hello,

    I am just wondering, if there is any possibility to get all controllers (for example of a module) and theire actions as an array?
  • HarroHarro
    Accepted Answer
    Not very easy.

    You can use the File class to enumerate all files in app/classes/controller, convert the filenames found to classnames (strip the extension, the "app/classes" prefix, replace DS by "_", and use the Inflector class to correct the case), then use Reflection to load the classes an get the method information.

    And in case of a Module you need to deal with the namespace somewhere in this process.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion