Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Rest Controller in subfoler
  • Hi all, does anyone have an idea how to get this working? I have a normal controller called "api" in my controller folder. It has one single action (index) just to present some api information. Now, I'd like to have a subfolder (api_controller) which holds several controller of type Rest which should respond with JSON format. My routes are like this
    'api/(:any)' => 'api_controller/$1',
    'api' => 'api/index',
    

    My goal is when accessing "http://domain.tld/api"; it only shows the api information and e.g. accessing "http://domain.tld/api/test/list.json"; then being routed to the action "list" of the controller "test" in the subfolder "api_controller". Is that possible? Thanks for your help! Regards,
    Bastian
  • I've figured it out... I renamed the subdirectory to "apicontroller", set the controller name like that: class Controller_Apicontroller_Test extends Controller_Rest { } and set the route tp 'api/(:any) => 'apicontroller/$1' and now everything works.

Howdy, Stranger!

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

In this Discussion