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.

The Role of a File Asset Manager

In web development, managing various types of files - such as JavaScript, CSS, and images - alongside PHP files can be challenging. Traditional PHP frameworks often adhere to the MVC design pattern, which does not provide a clear solution for handling non-PHP assets. This can lead to confusion and inefficiency when developing complex modules that require a variety of file types. The File Asset Manager in Trongate solves this issue. It does so by letting web developers store all necessary file assets - for any given module - within an assets sub-directory. This means that Trongate modules can be self-contained, highly-portable, and reusable.

Example

Consider a scenario where an invoicing system needs to be developed. In this case, a module might be created to handle the creation and management of invoices. Developing and testing such a module could take several days. Thus, having the 'invoicing' module function as a self-contained unit would be advantageous. This modular approach would allow for easy reuse of the 'invoicing' module in future projects by simply transferring the directory from one site to another. Trongate facilitates this modularity.

A potential challenge in this scenario would involve serving non-PHP files, such as specific JavaScript libraries, CSS files for styling invoices, or images. For example, the invoicing system might require a CSS file for invoice styling, a directory for storing company logos, or badges and logos for affiliated governing bodies. Traditional PHP frameworks do not provide an efficient way to manage these assets within the MVC design pattern.

Fortunately, Trongate resolves this issue. As a truly modular framework, Trongate allows modules to be entirely self-contained. This means that all necessary files for a feature, such as an invoicing system, can be included within a single module. This includes CSS, JavaScript, images, and other assets.

Truly Modular

Trongate's true modularity ensures that modules are self-contained. When building features like the aforementioned invoicing system, all required files can be housed within one module. This approach simplifies the process of managing and deploying features across different projects.

The code responsible for serving non-PHP assets within Trongate modules is known as the File Asset Manager.

This chapter provides detailed instructions on utilizing Trongate's File Asset Manager.

×