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

Special methods

This group of methods is designed to perform operations with data without interacting with other properties and methods of classes. These functions are static and located in the Service class.

  • cutText($text, $length[, $end]) - trim text to the required number of characters while preserving the last word. In the optional parameter you can pass a string value that will be added to the trimmed text if the original text is longer than the value of $length
  • randomString($length) - returns a random string in Latin in lowercase
  • strongRandomString($length) - returns a random string in Latin with upper and lowercase characters
  • addFileRoot($path) - adds the root of the file system to the file, $path must start from the root of the project, without the leading slash, usually userfiles/models/ or userfiles/images/
  • removeFileRoot($path) - removes the root of the file system, leaving the path to the file from the root of the project without the leading slash
  • getExtension($file) - returns the file extension without the dot
  • removeExtension($file) - returns the file path value without the extension
  • setFullHttpPath($path) - adds the current domain from the .env file to the link
  • translateFileName($file_name) - translates the file name into Latin transliteration
  • makeHash($string, $cost = 10) - returns the string hash, the password_hash() function
  • checkHash($string, $hash) - checks the string hash

Examples of using Service class methods

echo Service::cutText($text, 200, '...');

echo Service::randomString(7);

echo Service::strongRandomString(20);

echo Service::setFullHttpPath('/news/25');

echo Service::makeHash('hello');

Previous section

Sending email

Next section

Creating forms
MV workshop banner
MV tracker

© 2014-2025, MV framework team

MV tracker project Github