Creating a Brixy Plugin
Plugins in Brixy App Builder are built using the MVC (Model-View-Controller) architecture, which ensures a clear separation of concerns, scalability, and maintainability. Each plugin acts as an extension of functionality, triggered at a specific stage of the page lifecycle (e.g., onBeforeHeader, onBeforeRender, afterRender) through predefined Brixy App hooks.
Plugins do not require user interaction and can:
- Embed code, such as JavaScript for Google Analytics, Matomo, etc.;
- Modify or extend core data available at a specific lifecycle stage;
- Process information from the server or client using Model and Controller logic.
Plugin Structure:
Directories and files for custom plugins must be placed in the Extensions/Plugins directory.
⚠️ Caution: Custom plugins will not be overwritten or updated after a Brixy update. They are a separate part of the system.
Example structure:
Extensions/
└── Plugins/
└── plugin_category/
└── plugin_name/
├── Config/
│ └── Routes.php
├── Controllers/
│ └── Brixy_Ext_Plugin_Plugin_Name_Controller.php
├── Language/
│ └── en/
│ └── Brixy_Ext_Plugin_Plugin_Name.php
├── Models/
│ └── Brixy_Ext_Plugin_Plugin_Name_Model.php
├── Views/
│ ├── admin.php
│ └── default.php
├── plugin_name.php
└── plugin_name.json
Component Explanation:
| Element | Description |
| plugin_category | Unique folder name for plugin grouping (e.g., system, global, custom). |
| plugin_name | Unique name of the plugin |
| Config/Routes.php | Defines custom routes pointing to controller methods. Optional. |
| Controllers/Brixy_Ext_Plugin_Plugin_Name_Controller.php | Contains controller logic for handling requests. Optional. |
| Language/en/Brixy_Ext_Plugin_Plugin_Name.php | Language file for the plugin. The filename must use Snake Capital format. |
| Models/Brixy_Ext_Plugin_Plugin_Name_Model.php | Contains business logic and helper methods. Optional. |
| Views/admin.php | Admin UI template for plugin settings. Can be empty. |
| Views/default.php | Main plugin content rendered in a predefined position or used to modify Brixy data at a given hook stage. |
| plugin_name.json | Required JSON file containing plugin metadata such as name, position, description, etc. |
| plugin_name.php | Main plugin file, containing core methods. It must extend BasePlugin. |
Typical Use Case
The google_analytics plugin embeds JavaScript tracking code for Google Analytics. During the page lifecycle, it:
- Loads configuration (GA-XXXXX);
- Injects JavaScript code through the view;
All of this is invisible to the end user and is triggered automatically based on the defined hook stage onBeforeHeader.
Download Google Analytics Brixy Plugin - The archive file must be extracted in Extensions/Plugins/system.