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

Helpers Overview

Helpers are single-file collections of pure PHP functions. No classes. No namespaces. No autoloading drama. Just drop-dead simple functions you can call anywhere.

They live in engine/tg_helpers/ and get loaded automatically on every request. Zero effort required.

Trongate's Helper Files

Five files. Zero dependencies.

  1. Flashdata Helpers ← one-time session messages
  2. Form Helpers ← building forms without tears
  3. String Helpers ← text surgery & sanitization
  4. URL Helpers ← links, redirects, segments and more
  5. Utilities Helpers ← everything else you need

How to Use Them

Just call the functions. Anywhere. Anytime.

Example #1

Here's an example of how to redirect a user to a login page, using Trongate's helper:

Example #2

The code below demonstrates how to using Trongate's helper. This kind of code would typically be written inside a view file:

Why Helpers Beat "Modern" Alternatives

  • No includes. No config. No drama.
  • No Composer = runs forever
  • No classes = no instantiation overhead
  • No namespaces = no use statements
  • No service containers = no brain damage

For a technical, no-bs breakdown of everything that's included with Trongate's helpers, check out the Helpers Reference Guide.