Download the PHP package romanlazko/support-macroable without Composer
On this page you can find all versions of the php package romanlazko/support-macroable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download romanlazko/support-macroable
More information about romanlazko/support-macroable
Files in romanlazko/support-macroable
Download romanlazko/support-macroable
More information about romanlazko/support-macroable
Files in romanlazko/support-macroable
Vendor romanlazko
Package support-macroable
Short Description Trait Macroable to dynamically add methods to your PHP classes.
License MIT
Package support-macroable
Short Description Trait Macroable to dynamically add methods to your PHP classes.
License MIT
Please rate this library. Is it a good library?
Informations about the package support-macroable
Macroable Trait
A PHP trait that enables dynamic method addition to classes at runtime, inspired by Laravel's Macroable trait.
Installation
You can install the package via Composer:
Usage
Basic Macro Registration
Instance Macros
Macros can also be called on class instances:
Mixin Support
You can mix in multiple methods from another class:
Checking for Macros
Check if a macro exists:
Flushing Macros
Remove all registered macros:
Available Methods
macro(string $name, callable $macro): Register a new macromixin(object $mixin, bool $replace = true): Mix in methods from another classhasMacro(string $name): bool: Check if a macro existsflushMacros(): Remove all registered macros
Requirements
- PHP 7.4 or higher
License
This package is open-sourced software licensed under the MIT license.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
All versions of support-macroable with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.0
The package romanlazko/support-macroable contains the following files
Loading the files please wait ...