Macroable – A Trait to Dynamically add Methods to a PHP Class

New package by the folks from Spatie:

We recently released our newest package called macroable. It contains a trait that, when applied to class, can dynamically add methods to that class. This trait is basically a stand alone version of the macroable trait in Laravel.

It works by leveraging the __call() magic function, and checking if any macro has been registered via the static macro method.

A trait to dynamically add methods to a class →
spatie/macroable (GitHub) →

Elsewhere ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.