MV framework logo
  • Admin Panel
  • Architecture
  • Support
  • Feedback
Download .zip ver. 3.4.2 from 04.03.2026
Dark mode
Download .zip ver. 3.4.2 from 04.03.2026
  • Admin Panel
  • Architecture
  • Support
  • Feedback
Documentation:
Getting started
  • Installation and launch
  • Folder structure
  • Launching a simple website
  • Pre-installed models
  • SQLite getting started
  • System settings
  • Migrations
  • Debugging
Models
  • General principles of models
  • Data types
  • Model setup
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Managing simple models
  • Additional features
Templates and routing
  • General principles of templates
  • Router object
  • MV object
  • Create a new template
  • Output of data in template
  • Record object
  • Files and images
  • Date and time
  • Redirects and http
  • Sending email
  • Special methods
Forms
  • Creating forms
  • Setting up form fields
  • Validating form fields
  • Form security
  • Working with form data
  • Using data from models
  • Form methods
SQL queries
  • Query builder
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
Additional
  • AJAX
  • Sessions
  • Authorization
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
MV tracker
Dark mode
Documentation:
Getting started
  • Installation and launch
  • Folder structure
  • Launching a simple website
  • Pre-installed models
  • SQLite getting started
  • System settings
  • Migrations
  • Debugging
Models
  • General principles of models
  • Data types
  • Model setup
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Managing simple models
  • Additional features
Templates and routing
  • General principles of templates
  • Router object
  • MV object
  • Create a new template
  • Output of data in template
  • Record object
  • Files and images
  • Date and time
  • Redirects and http
  • Sending email
  • Special methods
Forms
  • Creating forms
  • Setting up form fields
  • Validating form fields
  • Form security
  • Working with form data
  • Using data from models
  • Form methods
SQL queries
  • Query builder
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
Additional
  • AJAX
  • Sessions
  • Authorization
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
MV tracker
Home Additional Plugins

Plugins

Plugins in MV are classes for performing tasks that do not require managing a table in the database, as is the case with models.

Plugins can be instantiated in the $mv object immediately upon its creation, and not like models using the lazy load principle.

Basic rules

  1. The plugin class must inherit from the Plugin class.
  2. The file must have a name like plugin_name.plugin.php and be located in the plugins folder in the root of the project.
  3. To activate a plugin, its class must be specified in the config/plugins.php file.
  4. The plugin object is available in the $mv -> PluginName object.
  5. The plugin is instantiated before the template is selected and included, immediately upon the creation of the $mv object, if the $auto_start property value is set.
//File plugins/cart.plugin.php

class Cart extends Plugin
{
    //If the plugin needs to be started before the template file is included
    protected $auto_start = true;
    
    private $items = [];
    
    private $products_model;
    
    public function __construct()
    {
        //Unlike models, the constructor can be supplemented
        parent :: __construct();
        
        //Product model object
        $this -> products_model = new Products(); 
    }
    
    public function addItemToCart($id, $quantity)
    {
        ...
    }
}

//Plugin activation in the config/plugins.php file
$mvActivePlugins = [..., 'Cart'];

//Example of using the plugin in a template file
$mv -> cart -> addItemToCart(56, 2);

Previous section

Authorization

Next section

Caching
MV workshop banner
MV tracker

© 2014-2026, MV framework team

MV tracker project Github