JasonLewis Posted August 5, 2010 Share Posted August 5, 2010 Not really anything help related, more opinion related. Currently with my framework controllers can only be placed in either the root /controllers directory or in a single subfolder, such as /controllers/admin Is that far enough or should it be unlimited. What I am doing though is following a naming convention for controller class names. Say I had a controller called /controllers/account_settings.php It's class declaration would look like: class AccountSettingsController extends Controller When a controller is in a subdirectory, the name of the directory must also be prepended to the class name. So if the controller is now /controllers/members/account_settings.php the class declaration would be: class MembersAccountSettingsController extends Controller I did it purely for organization. I figured people wouldn't want/need anything more then 1 level deep, however sometimes they might. So really, what's your take on how far a controller can be nested in the controllers directory. And is my naming convention okay? Quote Link to comment https://forums.phpfreaks.com/topic/209898-feature-opinion/ Share on other sites More sharing options...
trq Posted August 5, 2010 Share Posted August 5, 2010 When a controller is in a subdirectory, the name of the directory must also be prepended to the class name. So if the controller is now /controllers/members/account_settings.php the class declaration would be: That seems a very confusing and limiting method. Most frameworks use the PEAR naming convention which makes it VERY easy to place files wherever you like as long as its on the include path. Controllers, views, and models however are likely to require there locations to be configurable, though I guess it depends on the framework. Some frameworks prefer convention over configuration which usually makes them easier to use. You simply force users to do it your way. However, force to hard, and users will break the rules, hack your framework, or move on to something less restrictive. Quote Link to comment https://forums.phpfreaks.com/topic/209898-feature-opinion/#findComment-1095761 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.