Theme editor

[MMO] Core Library

[MMO] Core Library

[MMO] Core Library 2.2.7

XF 2.2 Addons · by Staraddons · StarAddons Verified Vendor
0 Downloads 20 Views 1 Version
A library that contains helper functions for our add-ons.
Price
Free
Available
Download

Overview Version (1) Discussion (1)

  • [MMO] Core Library
    [MMO] Core Library
    A library that contains helper functions for our add-ons.
    core library
    About this resource
    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:
    Expand Collapse Copy
    {
        "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:
    Expand Collapse Copy
    $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:
    Expand Collapse Copy
    $macroableClass = new class() {
    
        protected $name = 'myName';
    
        use Illuminate\Support\Traits\Macroable;
    };
    
    $macroableClass::macro('getName', function() {
       return $this->name;
    };
    
    $macroableClass->getName(); // returns 'myName'

    5. Collections. New in 2.2.3

    The MMO\CoreLib\Util\Collection class provides a fluent, convenient wrapper for working with arrays of data. The collect helper returns a new MMO\CoreLib\Util\Collection instance for the given array. So, creating a collection is as simple as:
    PHP:
    $collection = collect([1, 2, 3]);
    Collections are "macroable", which allows you to add additional methods to the Collection class at run time. The MMO\CoreLib\Util\Collection class' macro method accepts a closure that will be executed when your macro is called. The macro closure may access the collection's other methods via $this, just as if it were a real method of the collection class.
  • Version
    2.2.7 Stable Available Nov 4, 2025 · 0
    File size: 1.3 MB
    SHA-256: c294e210837ae6bcc34f47430db1d75fd6d0af57468de3b2a945ebaeb16e2730
    SHA-256 verified Package valid Compatibility checked Last verified:
    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:
    Expand Collapse Copy
    {
        "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:
    Expand Collapse Copy
    $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:
    Expand Collapse Copy
    $macroableClass = new class() {
    
        protected $name = 'myName';
    
        use Illuminate\Support\Traits\Macroable;
    };
    
    $macroableClass::macro('getName', function() {
       return $this->name;
    };
    
    $macroableClass->getName(); // returns 'myName'

    5. Collections. New in 2.2.3

    The MMO\CoreLib\Util\Collection class provides a fluent, convenient wrapper for working with arrays of data. The collect helper returns a new MMO\CoreLib\Util\Collection instance for the given array. So, creating a collection is as simple as:
    PHP:
    $collection = collect([1, 2, 3]);
    Collections are "macroable", which allows you to add additional methods to the Collection class at run time. The MMO\CoreLib\Util\Collection class' macro method accepts a closure that will be executed when your macro is called. The macro closure may access the collection's other methods via $this, just as if it were a real method of the collection class.
  • Discussion

    This resource has a discussion thread on the forum where you can ask questions, report issues, and talk with the author and other users.

    Join the discussion (1)

Resource information
Category XF 2.2 Addons
Author Staraddons
Date Nov 4, 2025
Latest version 2.2.7
SHA-256 c294e210837ae6bcc34f47430db1d75fd6d0af57468de3b2a945ebaeb16e2730
Security
File integrity SHA-256 verified
SHA-256
c294e210837ae6bcc34f47430db1d75fd6d0af57468de3b2a945ebaeb16e2730
How to verify this file
Statistics
Views 20
Downloads 0
Version 1
Developer
Staraddons
Resource author
More resources
Back
Top