MV framework logo
  • Architecture
  • Philosophy
  • Admin panel
  • Support
  • Feedback
Documentation
Download .zip version 3.2.0 from 25.12.2024
  • Architecture
  • Philosophy
  • Admin panel
  • Support
  • Feedback
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
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
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
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
MV tracker

System settings

At the root of the project there is a folder with config settings files, which contains the following files with settings:

  • models.php - active models
  • plugins.php - active plugins
  • routes.php - routes for linking URLs and templates
  • settings.php - general settings
  • setup.php - basic settings for running the project, it is recommended to fill in the basic settings in the root file .env

The settings are designed as regular and associated arrays. You can add additional custom settings and they will be available anywhere in the project through the Registry class, based on the Singleton pattern.

Basic settings in the .env file

APP_ENV - development/production mode
APP_DOMAIN - domain name with http(s)
APP_FOLDER - project directory, / - if the project is in the root of the domain
APP_TIMEZONE - time zone
APP_TOKEN - secret key for generating hashes
APP_REGION - localization (en, us, ru, de)
APP_TOKEN will be generated automatically when installing via Composer, or MV will suggest a random value if necessary.

Other settings from the config/setup.php and config/settings.php files

  • Build - the number of the current application build, affects the cache update, it is recommended to increase the number by 1 when uploading a new version of the code to the production server.
  • DebugPanel - displaying the debug panel in all views.
  • AdminFolder - the name of the folder with the administrative panel, to change the folder, you need to change the setting and rename the folder.
  • SessionSupport - support for the standard PHP session.
  • FilesPath - a folder with user files, also useful methods for working with files are in the sections Special methods and Files and images.
  • ModelVersionsLimit - a limit on the number of record versions for all active models. For each model, this parameter can be set individually, for more details, see the section Model settings.

Access to settings

To access settings in models and templates, the Registry class is used, which is available inside all MV components, as well as inside the $mv object. The Registry class uses a single array to store settings, so the names in the .env,  settings.php and setup.php files should not overlap.

In model classes, the 'MainPath' value (the URL from the domain root to the project, usually '/' on the production server) is available as the $root_path property, a similar property is also available on the object described in the MV Object section.

//Examples of getting settings from anywhere
Registry :: get('APP_DOMAIN');

//Project file root
Registry :: get('IncludePath');

//Secret key
Registry :: get('APP_TOKEN');

//Maximum file size
Registry :: get('MaxFileSize');

//Inside a model or plugin class
class Articles extends Model
{
    ...

    public function display()
    {
    ...

        $html .= Registry :: get('MainPath').'article/'.$row['id'];

        //or similar
        $html .= $this -> root_path.'article/'.$row['id'];
    }
}

//You can add your own settings on the fly and they will be available throughout the project
Registry :: set('MySetting', 57);
Registry :: set('SpecialSetting', ['a', 'b', 'c']);

Previous section

SQLite getting started

Next section

Migrations
MV workshop banner
MV tracker

© 2014-2025, MV framework team

MV tracker project Github