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

Module Assets

CSS. JS. Images. PDFs. Fonts.

Drop them anywhere in your module.

They’re served. Instantly. Securely.


How It Works

If a file URL contains _module → the file is served from the corresponding module.

Example structure:

All of the non-PHP files above can be served via the following URLs:

  • https://example.com/users_module/images/avatar.png
  • https://example.com/users_module/js/script.js
  • https://example.com/users_module/files/resume.pdf

It just works.


The Trigger

The key to having beautiful URLs that serve module assets is to use the module assets trigger. Here's how URLs, with a module assets trigger, get structured:

For example:

How To Change The Module Assets Trigger

The module assets trigger is defined in config/config.php:

Change it if you must. But don’t name modules with _module.

Never name a module users_module.

Use users. Avoid 404s and confusion.

Don't try to serve PHP files using the module assets trigger. It won't work.

Don't give any of your directories or files stupid names. That won't work either.

Assets must be in a subdirectory. No root-level files.

v2 Change: The old assets/ folder is gone.

Store files directly in css/, js/, images/, files/ - or any subfolder you like.