Quantcast
Channel: php – Bram.us
Viewing all articles
Browse latest Browse all 166

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

$
0
0

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) →


Viewing all articles
Browse latest Browse all 166

Trending Articles