trOnGAtE

Why We Need A File Asset Manager
Trongate is a modular PHP framework. However, there are times when your modules may require files that are not PHP files. Perhaps you might have a particular module that uses; JavaScript files, CSS files, images and more. This is where Trongate’s File Asset Manager comes to the rescue!
The File Asset Manager is a feature that has been built into the Trongate framework. The goal of the File Asset Manager is to enable modules to be self-contained. Specifically, this means that modules have the ability to store and serve multiple different types of files.
Example
Let's imagine you've constructed a payment gateway for WorldPay. So, in that scenario, you may have a module that lets users add payment card details whenever they're making a purchase from a website.
It's possible that such a module could take two or three days to build and test. Therefore, it makes perfect sense to have your 'worldpay' module functioning as a self-contained module. This means that the next time you're building a website that uses WorldPay, you could easily reuse your 'worldpay' module - simply by dragging and dropping a folder from one site to another. Trongate makes this possible.
A potential challenge could involve the serving of files that are not PHP files. For example, perhaps your payment gateway requires a particular JavaScript library or a few CSS files. In the case of a payment gateway, it's normal to display images such as - for example - a WorldPay logo or an image depicting a row of payment cards that your app accepts.
In the past, this type of situation was extremely problematic for PHP developers. That's because most PHP frameworks encourage the usage of the MVC design pattern. The MVC design pattern does not address the obvious question,
"Where should you store all the other stuff?"
Fortunately, this is not an issue that Trongate developers have to worry about. That's because Trongate is a truly modular framework.
Truly What?
Trongate is truly modular. This means that Trongate modules are self-contained. So, whenever you build a feature such as a payment gateway, as described above, it's easy to have all the files required for your payment gateway all contained within one module. This includes CSS, JavaScript, images and more.
The code, inside the Trongate framework, that is responsible for serving non-PHP assets is called The File Asset Manager.
This chapter contains instructions on how to use Trongate's File Asset Manager.
HELP & SUPPORT
If you have a question or a comment relating to anything you've see here, please goto the Help Bar.