spatie/macroable
Add methods to any class at runtime with Spatie’s Macroable trait. Register macros with closures or callables and call them like native methods; macros are bound to the class instance for access to $this. Inspired by Laravel’s Macroable implementation.
A trait to dynamically add methods to a class
How can I help you explore Laravel packages today?