Introduction
Basic Concepts
Understanding Routing
Intercepting Requests
Module Fundamentals
Database Operations
Templates
Helpers
Form Handling
- Form Handling Fundamentals
- Creating Forms
- Form Input Fields
- Textareas and Dropdowns
- Checkboxes and Radio Buttons
- Form Labels
- Retrieving Form Data
- Form Validation Basics
- Displaying Validation Errors
- The Create/Update Pattern
- CSRF Protection
- Custom Validation Rules
- Form Helper Reference
- Validation Rules Quick Reference
- Best Practices For Handling Data
Working With Files
Image Manipulation
Working With Dates & Times
Authorization & Authentication
Coding Style Guidelines
Trongate doesn’t wrap PHP in conventions, or abstractions. It is PHP - raw, fast, and unapologetic. This is Native PHP: code that runs like it was written by someone who actually loves the language.
Core Principles
- Zero bloat. Zero abstraction.
- Write PHP exactly as the creators of the language intended.
- If it doesn’t make your code faster or clearer, it doesn’t belong.
The overwhelming majority of PHP’s built-in functions use snake_case. So should you.
Why Snake Case Wins
- The overwhelming majority of PHP's core functions use snake_case, including :
- Snake case eliminates the eternal
userIdvsuserIDvsUserIdholy wars. - Snake case reads naturally:
get_user_by_id()>getUserByID().
array_merge()class_exists()file_get_contents()function_exists()str_replace()strip_tags()...and more!
Many PHP frameworks encourage the usage of camelCase. Unfortunately, camelCase introduces unnecessary ambiguity. Consider the following example, which compares camelCase PHP with Native PHP:
// Which is it? ID? Id? iD?
$userId = getUserByID($userID);
// vs Native PHP:
$user_id = get_user_by_id($user_id);
No debate. No style-guide meetings. Just simple code.
K&R Style - Because C Got It Right
PHP was built with the C programming language. We honor that. All official examples use Kernighan & Ritchie bracing:
function hello_world() {
echo "Hello, world!\n";
}
if ($user_is_logged_in) {
grant_access();
} else {
deny_access();
}
- Four spaces. No tabs. Ever.
- Opening brace on same line.
- Closing brace aligns with the command.
The Only Rules That Matter
- Consistency beats dogma.
- Clarity beats cleverness.
- Speed beats ceremony.