M

modHelpers

By Serg Shlokov (sergant210)


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 '

' . faker()->date() . img(faker()->imageUrl(100,100),['class'=>'img-news']) . ' ' . faker()->text(700) . '<.div>';});

See details on GitHub.

Serg Shlokov


New in modHelpers 3.7.0

More

Information

Released
February 13, 2019
Supported Versions
2.3 – Current
Downloads
3,280
License
GPLv2

Previous Versions

3.7.0-beta
February 11, 2019
2.3 – Current
3.6.0-beta
October 4, 2018
2.3 – Current
3.5.1-beta
April 17, 2018
2.3 – Current
3.5.0-beta
April 11, 2018
2.3 – Current
3.4.0-beta
April 2, 2018
2.3 – Current
3.3.0-beta
February 5, 2018
2.3 – Current
3.2.1-beta
December 29, 2017
2.3 – Current
3.2.0-beta
December 19, 2017
2.3 – Current
3.1.1-beta
November 20, 2017
2.3 – Current
3.1.0-beta
November 19, 2017
2.3 – Current
3.0.1-beta
October 20, 2017
2.3 – Current
3.0.0-beta
October 2, 2017
2.3 – Current
2.1.0-pl
August 22, 2017
2.3 – Current
2.0.0-pl
August 5, 2017
2.3 – Current
1.5.0-pl
August 5, 2017
2.3 – Current
1.4.0-beta
March 22, 2017
2.3 – Current
1.3.0-beta
February 5, 2017
2.3 – Current
1.2.0-beta
January 23, 2017
2.3 – Current
1.1.0-beta
January 16, 2017
2.3 – Current
1.0.2-beta
January 14, 2017
2.3 – Current
1.0.1-beta
January 2, 2017
2.3 – Current
1.0.0-beta
January 1, 2017
2.3 – Current
More

More from Serg Shlokov

modalConsole

It's a modal console for PHP.

View
siteStatistics

Page and user visits statistics

View
controlErrorLog

Closing the window by clicking on the icon

View
AdminTools

Adds some features for MODX administrators and developers.

View