0%
[MMO] Core Library

FREE Addons [MMO] Core Library 2.2.7

No permission to download

New threads Top posters New members General forum statistics

    • Thread
      Forum
      Messages
      View
      Date
      By
      Last reply
  • Loading…
  • Loading…
  • Forum statistics

    Threads
    228
    Messages
    286
    Members
    11
    Latest member
    PuNkReAS
    Member time online
    1d 7h 42m
1. Introduction

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

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:
<span>$macroableClass</span> <span>=</span> <span>new</span> <span>class</span><span>(</span><span>)</span> <span>{</span><br> <span>use</span> <span>Illuminate<span>\</span>Support<span>\</span>Traits<span>\</span>Macroable</span><span>;</span><br><span>}</span><span>;</span><br><br><span>$macroableClass</span><span>:</span><span>:</span><span>macro</span><span>(</span><span>'concatenate'</span><span>,</span> <span>function</span><span>(</span><span>.</span><span>.</span><span>.</span> <span>$strings</span><span>)</span> <span>{</span><br> <span>return</span> <span>implode</span><span>(</span><span>'-'</span><span>,</span> <span>$strings</span><span>)</span><span>;</span><br><span>}</span><span>;</span><br><br><span>$macroableClass</span><span>-</span><span>&gt;</span><span>concatenate</span><span>(</span><span>'one'</span><span>,</span> <span>'two'</span><span>,</span> <span>'three'</span><span>)</span><span>;</span> <span>// returns 'one-two-three'</span>
Callables passed to the macro function will be bound to the class
PHP:
<span>$macroableClass</span> <span>=</span> <span>new</span> <span>class</span><span>(</span><span>)</span> <span>{</span><br> <br> <span>protected</span> <span>$name</span> <span>=</span> <span>'myName'</span><span>;</span><br> <br> <span>use</span> <span>Illuminate<span>\</span>Support<span>\</span>Traits<span>\</span>Macroable</span><span>;</span><br><span>}</span><span>;</span><br><br><span>$macroableClass</span><span>:</span><span>:</span><span>macro</span><span>(</span><span>'getName'</span><span>,</span> <span>function</span><span>(</span><span>)</span> <span>{</span><br> <span>return</span> <span>$this</span><span>-</span><span>&gt;</span><span>name</span><span>;</span><br><span>}</span><span>;</span><br><br><span>$macroableClass</span><span>-</span><span>&gt;</span><span>getName</span><span>(</span><span>)</span><span>;</span> <span>// returns 'myName'</span>

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:
<span>$collection</span> <span>=</span> <span>collect</span><span>(</span><span>[</span><span>1</span><span>,</span> <span>2</span><span>,</span> <span>3</span><span>]</span><span>)</span><span>;</span>
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.

6. 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
OneHub
SUPER ADMIN
Joined
Messages
267
Reactions
17
Trophy points
18
2.2.7 Version
0 Downloads
370 Views
First release
last_update
0.00 star(s) 0 ratings
Author
OneHub
Downloads
0
Views
370
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from OneHub

Back
Top Bottom