• MODX.com

    2,170 downloads

  • modstore.pro

    346 downloads

modHelpers

modHelpers is an extra by sergant210, first released on 2018-10-04.

Package Description

Library of the helpfull functions for MODX. Available more than 70 functions.It requires PHP 5.5+.

# Send an email

email('darling@mail.com', 'Subject', 'Email content');

email_user('admin', $subject, $content);  // To user

# Check the user existence

if (user_exists(['email'=>'admin@mail.com']) { // Exists }

# Verify the email

if (!is_email($_POST['email']) { // Validation error }

# Get the data from the cache

$value = cache('key', 'my_data');

# Get lexicon record

$name = lang('language_key');

# Redirect to the page with the id = 5

redirect(5);

# Remove resources of the category with the id = 10

resources()->where(['parent'=>10])->remove();

# Get users from the group "Managers"

$usersArray = users()->members('Managers')->toArray();

Use is_auth() instead of $modx->user->isAuthenticated($modx->context->key)

# Make a list of faked news (using a snippet)

return collection(10)->each(function($item, $idx, $modx){return '<div>' . faker()->date() . img(faker()->imageUrl(100,100),['class'=>'img-news']) . ' ' . faker()->text(700) . '<div>';});

See details on GitHub.

Usage/Installation Instructions

Via Package manager.

Details

Developer(s)
sergant210
Released
2018-10-04
First seen
2018-10-04
License
GPLv2
Supported databases
MySQL
Minimum MODX Requirement
2.3

modHelpers Releases

Vendor Signature Released on
MODX.com 3.6.0-beta 2018-10-04 (1 month ago)
modstore.pro 3.5.1-beta 2018-04-17 (7 months ago)
MODX.com 3.5.1-beta 2018-04-17 (7 months ago)