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

Custom Routing

Automatic routing is brilliant 99% of the time. This page is for the 1% when you want to bend URLs to your will.

Here's how it works. Open: config/custom_routing.php

Add one line. Refresh. Done.


Basic Routes – “Pretend You’re Somewhere Else”

Want /login to secretly run users/login?

Result: Address bar stays /login. User sees login form. You look clever.


Dynamic Routes? It's Wildcards Ahoy!

Need to catch IDs, slugs, or entire paths? Three wildcards. No more. No less.

Wildcard Matches Use When
(:num)123Numeric IDs
(:any)macbook-proSlugs, categories
(:all)docs/api/v2/whateverCapturing everything after
MUST BE LAST

CRITICAL RULE:

If using (:all) it must be the final segment in your pattern.

Below is an example of a custom_routing.php file that demonstrates using wildcards to map dynamic URLs to specific controllers and methods.