Introduction
Basic Concepts
Understanding Routing
Intercepting Requests
Module Fundamentals
Database Operations
Templates
Helpers
Form Handling
Form Validation
Working With Files
Image Manipulation
Working With Dates & Times
Language Control
Authorization & Authentication
Naming Your Modules
You already know what a module looks like.
You’ve seen users/, Users.php, views/, etc.
Now, stop overthinking it!
The Rules (Yes, There’s Only Two)
- Folder: lowercase. Usually plural.
→users,products,blog_posts - Controller: Capitalized first character. Singular or plural? Whatever.
→Users.phporApi.php- we don’t care
Here’s an example of a module with a poorly named controller file:
modules/
users/ ← good
blog_posts/ ← good
api/ ← good (singular is fine)
User/ ← wrong (capitalized folder)
usersController.php ← wrong (don’t be this person)
Trongate does not enforce naming. but if you name a folder User or a file usersController.php,
the ghosts of PHP past will haunt your dreams.
Model Files (Optional, Like Pants)
Model files handle data-related tasks. Name them by taking the controller name and adding _model.php.
- Example →
Users_model.php - Alternatively → just write SQL in the controller like a true Native PHP warrior
Views & Assets
snake_case. Always.
create_user.php, users_table.css, delete_confirmation.js
In Trongate, view files are always PHP files (ending in .php).
Pro tip: If you’re spending more than 3 seconds thinking about naming, you’re doing it wrong.