Creating a Brixy Module

Modules in Brixy App Builder are lightweight content blocks designed to render visible output on the page. Unlike plugins, which usually operate behind the scenes, modules are intended for user-facing content, such as banners, menus, statistics, widgets, or other small reusable components.

Each module follows a flexible MVC (Model-View-Controller) structure:

The Model (Models/) can be used to handle data operations;

The View (Views/) contains the HTML output for both the frontend (default.php) and admin settings (admin.php);

The Controller (Controllers/) can be included for more advanced logic or request handling.

Both Controllers/ and Models/ directories are optional, depending on the module's complexity.

Modules may also include:

  • Customizable settings through the admin interface;
  • Multilingual support using language files;
  • Placement in predefined module positions on the page layout.

Modules are rendered during page load and display content dynamically based on the current route, user, or data context.

Module Structure

Directories and files for custom modules must be placed in the Extensions/Modules directory.

⚠️ Caution: Custom modules will not be overwritten or updated after a Brixy update. They are a separate part of the system.

Example structure:

Extensions/
└── Modules/
    └── module_category/
        └── module_name/
            ├── Config/
            │   └── Routes.php              (optional)
            ├── Controllers/
            │   └── Brixy_Ext_Module_Module_Name_Controller.php  (optional)
            ├── Language/
            │   └── en/
            │       └── Module_Name.php
            ├── Models/
            │   └── Brixy_Ext_Module_Module_Name_Model.php       (optional)
            ├── Views/
            │   ├── admin.php
            │   └── default.php
            ├── module_name.php
            └── module_name.json

Component Explanation

Element Description
module_category Unique folder name grouping related modules (e.g., system, custom, widgets).
module_name Unique name of the module. Used as the directory name and in file references.
Config/Routes.php Optional file to define internal routes for the module controller.
Controllers/Brixy_Ext_Module_Module_Name_Controller.php Optional controller file containing logic and actions.
Language/en/Module_Name.php Language file for the module. The name must follow Snake Capital format.
Models/Brixy_Ext_Module_Module_Name_Model.php Optional model for database or logic handling.
Views/admin.php Optional admin interface for module settings. Can be left empty.
Views/default.php Main frontend content of the module shown in a layout position.
module_name.php Main Module Class that defines module initialization and logic.
module_name.json Required file defining the module’s metadata (name, description, position, etc.).

module_name.json sample content:

{
	"module_name": "module_name",
	"section"	: "app", (app|admin|both)
	"category"	: "module_category",
}

module_name.php sample base content:

<?php
namespace brixy\Extensions\Modules\module_category\module_name;
use brixy\Common\Libraries\BaseModule;	
	
class module_name extends BaseModule {
	
 	function __construct(){
		helper(['filesystem']);
		$this->module_name = str_replace(__NAMESPACE__. '\\', '',__CLASS__);
	}
	
	function init_admin(){
		
		$result = [
			'layouts_list' => $this->get_brixy_module_layouts(),
		];
		return $result;
	}
	
	function init($params){
	
	}
}
?>

Load module on page - In module settings need to set module position then show module with

<?php load_modules_position('module_position') ?>

Download Tradingview Brixy Module - The archive file must be extracted in Extensions/Modules/tradingview_widgets.