Registry / utility / spatie-macroable

spatie-macroable

JSON →
library2.1.0phppackagistunverified

A trait to dynamically add methods to a class, enabling macro-like functionality.

composer require spatie/macroable
INSTALL
IMPORT
SIG · SPATIE-MACROABLE
S
spatie-macroable
utilityphpv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Macroable
use Spatie\Macroable\Macroable;

Add a macro method to a class using the Macroable trait

<?php use Spatie\Macroable\Macroable; class MyClass { use Macroable; } MyClass::macro('hello', function () { return 'Hello World'; }); echo MyClass::hello();
Debug
Known issues

No known issues recorded.

Upgrade
Version history
2.1.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources