A module — is a structural entity, which is the folder with the file Module.php and other files, including php-classes. The module name is the same as the folder name and namespace. Usually, one top-level namespace without nesting is used. All active modules must be registered in the config (key 'modules').

File Module.php must contain heir class from System\AModule with class name Module and namespace equals to module name:

namespace Docs;
class Module extends \System\AModule {
	public $description = 'Documentation for BlackFox framework';
	public $version = '1.0';

	public function Upgrade() {

	public function Load() {

	public function Menu() {
		return [];
description (optional)
version (optional)
called when installing or modifying a module, used to synchronize the structure of tables and other amendments (see heirs for an example)
always called if the module is active
called by the admin menu unit, should return an array describing the administrative menu section (see heirs for an example)

Autoload classes

By default, the module scans own subfolders of classes and units, looks for any php-files in them and registers them as classes with the same name in the namespace of the module. Scan depth varies:

Thus, when developing your own module, place classes in a subfolder classes, units in a subfolder units, name files equals to classes inside them, then they will be automatically registered in the engine.

Own autoload classes

If desired, the described above behavior can be overridden. To do this, override the module’s GetClasses method. The method takes no parameters and must return a dictionary:


A model — is a set of classes that describe the business logic of an application.
I recommend placing them in a subfolder classes of the module in order for the engine to register them in autoload.
I recommend to use a single namespace with no nesting to make it convenient to refer to other classes.
A model class can be original or inherit any other class. but generally the model class is a hereditary from SCRUD, describing the structure and access to the database table.


Controllers — are a collection of classes that describe the order of access to the classes and methods of the model and (optional) connects the result of their execution to a view.
A controller class can be original or inherit any other class. but generally the model class is a hereditary from Unit and is located in the subfolder units of the module.

Ask question