[MMO] Core Library

[MMO] Core Library 2.2.2

No permission to download
Compatible XF 2.x versions
  1. 2.2
Additional requirements
php 7.1
Visible branding
No
A library that contains helper functions for our add-ons.

1. Introduction

During use, Add the requires section to addon.json to document the dependancy:
JSON:
{
    "require": {
        "MMO/CoreLib": [
            2020270,
            "[MMO] Core Library v2.2.2+"
        ]
    }
}

2. Template additions

We are adding various functions for templates that will make it easier for you to work with them, as well as add several useful functions.

Template Function: mcl_diff_for_human
Get the difference time in a human readable format in the current locale

Template Function: mcl_phrase_plural
After defining a translation phrase that has pluralization options, you may use the mcl_phrase_plural function to retrieve the phrase for a given "count".

3. Options

MMO\CoreLib\Option\UserGroup - Displays a list of user groups with the ability to select a checkbox type.
MMO\CoreLib\Option\UserUpgrade - Displays a list of promotions of user groups with the ability to select the type of checkbox
MMO\CoreLib\Option\CustomFields\Contact - Displays additional user fields of type contacts
MMO\CoreLib\Option\CustomFields\Personal - Displays additional user fields of type personals
MMO\CoreLib\Option\CustomFields\Prefefernces - Displays additional user fields of type preferences

4. Traits. New in 2.2.3

Macroable - A trait to dynamically add methods to a class.
PHP:
$macroableClass = new class() {
    use Illuminate\Support\Traits\Macroable;
};

$macroableClass::macro('concatenate', function(... $strings) {
   return implode('-', $strings);
};

$macroableClass->concatenate('one', 'two', 'three'); // returns 'one-two-three'
Callables passed to the macro function will be bound to the class
PHP:
$macroableClass = new class() {
   
    protected $name = 'myName';
   
    use Illuminate\Support\Traits\Macroable;
};

$macroableClass::macro('getName', function() {
   return $this->name;
};

$macroableClass->getName(); // returns 'myName'

5. Conclusion

At this point I should acknowledge the work of Taylor Otwell and other contributors to the Laravel PHP Framework - the [MMO] Core Lib was heavily inspired by the framework developed for Laravel and some of the reflection classes are taken directly from the Illuminate\Support component. The library also uses some separate libraries from the framework. And it is worth praising for the tighten collections outside of laravel
Author
kick
Downloads
37
Views
607
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kick

Latest updates

  1. 2.2.2

    Add Pluralization phrases. In the future, it is planned to support conditions in phrases. Added...
  2. 2.2.1

    Small refactor Add helper functions for String and Array
Top