The Trongate PHP Framework
Documentation
Introduction
Quick Start
Basic Concepts
Understanding Routing
Controllers
Views
Assets
Modules Calling Modules
Parent & Child Modules
Database Operations
Modules within Modules
Templates & Themes
Helpers Explained
Form Handling
Working with Files
The Module Import Wizard
Authorization & Authentication
The API Explorer
Best Practices

Help Improve Our Docs

If you’ve found an error, spotted something missing, or feel a section could be clearer or better explained, we’d love to hear from you. Your feedback helps keep the documentation accurate and useful for everyone.

Please report issues or suggest improvements on GitHub. Community input is invaluable in making the docs stronger.

Not comfortable with GitHub? No problem — you can also get in touch with us directly via our contact form. We welcome all feedback.

Routing: An Overview

In web development, routing is the process of directing incoming web requests to the appropriate code that should handle those requests. Trongate's routing system manages this by mapping URLs (Uniform Resource Locators) to specific modules, controllers, and methods within your application.

Trongate uses a segment-based URL routing approach that creates clean, user-friendly URLs. This is in contrast to traditional PHP applications that often use query strings with symbols like question marks and ampersands.

Routing Example

Consider a product page on an e-commerce website. Using traditional PHP, you might see a URL like this:

With Trongate's routing system, you can create more readable and professional URLs like this:

Clean URLs like this offer several benefits:

  • They're easier for users to read, understand, and remember
  • They look more professional and trustworthy
  • They're more friendly for search engine optimization (SEO)
  • They hide implementation details of your application

Trongate provides three main ways to handle routing:

  1. Homepage Routing: Special rules for handling requests to your website's homepage
  2. Automatic Routing: URLs are automatically mapped to your code based on simple conventions
  3. Custom Routing: Define your own URL patterns for specific needs

The following pages will explore each of these routing methods in detail, showing you how to create clean, professional URLs for your web applications.

×