Macroable Package is a trait that, gives you the ability in effect to add new methods to a class at runtime.

Installation

With Composer

composer require glowy/macroable

Usage

use Glowy\Macroable\Macroable;

Methods

hasMacro Checks if macro is registered.
macro Register a custom macro.
mixin Mix another object into the class.