Trongate PHP Framework Docs
Introduction
Quick Start
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
Security
Tips And Best Practices

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)

  1. Folder: lowercase. Usually plural.
    users, products, blog_posts
  2. Controller: Capitalized first character. Singular or plural? Whatever.
    Users.php or Api.php - we don’t care

Here’s an example of a module with a poorly named controller file:

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.

We're continually improving the Trongate documentation. If anything is incorrect, unclear, incomplete, or could be better, we'd genuinely appreciate your input.

Share your thoughts in the Documentation Feedback.

Leave Feedback About This Page