Trongate Docs
switch to dark modeswitch to dark mode
What Is A Controller?

What Is A Controller?

A ‘controller’ is a file that contains business logic. In the case of the Trongate Framework, this means a PHP file that contains some sort of code for controlling how the application works.

Consider the structure of a module.

a Trongate module

All of the modules inside a Trongate app will contain a folder called 'controllers'. Normally (though not always) the controllers folder will contain one PHP file. This PHP file will be the controller for the module. You can think of the controller as being the brains of the module.

Key Features

Below are some features that all Trongate controller files have in common:

  • Controller files always share the same name as the module that they belong to.
  • Controller file names always have an uppercase first character.
  • Controller files always contain a class that extends the main 'Trongate' class.

Just To Let You Know
This documentation (and the Trongate Desktop App) favours pluralised names for both modules and controller files. However, this is not enforced. You are welcome to use either singular or pluralised names as you please. Also, this documentation (and the Trongate Desktop App) favours snake_case for module names, PHP file names and function/method names. Again, this decision is not enforced.


If you have a question or a comment relating to anything you've see here, please goto the Help Bar.