Open chrisasek opened 2 weeks ago
Hi @chrisasek , You can. Please check the documentation: https://github.com/izniburak/php-router/wiki/5.-Controllers#basic-usage
In the documentation you can set the path for the controllers.
If I set the path as app/controllers for example and I want to have a folder let's say 'user' for all the user controllers.
When I load a controller from the user folder inside the set controllers folder, I throw an error.
Could you please share your directory structure and routing definition?
Controllers from the admin folder or admin aren't working.
I don't see any problem about the folder structure. Are you sure about the namespaces of the controllers in subfolder? Also, what is the APP_URL
constant value? base_folder
option of the Router config should be folder name of the folder that the project run in.
BTW, I use similar structure on a project, I have no any issue. Probably, you have an configuration or definition issue.
I have double check on my end, the namespaces are same and the base_folder is the root of the project like you mentioned.
I checked the resolveClassName function in Router.php on line 668, it doesn't account for subfolder in the controller set path.
What do you think?
How do you use your controllers that defined in subfolder when add a new router? Can you share your related routing definition? I try to reproduce your flow in my local.
BTW, this project is public in Github? Maybe I can check the issue detailed.
I just added a public project for you to check the issue: https://github.com/chrisasek/Dicer-mvc
I want to use sub-folders inside the Controllers folders.