fyre/macro
最新稳定版本:v2.0.1
Composer 安装命令:
composer require fyre/macro
包简介
A macro utility library.
README 文档
README
FyreMacro is a free, open-source macro utility library for PHP.
Table Of Contents
Installation
Using Composer
composer require fyre/macro
Macros
You can attach Fyre\Utility\Traits\MacroTrait to any class.
use Fyre\Utility\Traits\MacroTrait; // in any class class MyClass { use MacroTrait; }
Clear Macros
Clear all macros.
MyClass::clearMacros();
Has Macro
Determine whether a macro is registered.
$nameis a string representing the name of the macro.
$hasMacro = MyClass::hasMacro($name);
Macro
Register a macro.
$nameis a string representing the name of the macro.$callbackis the macro callback.
MyClass::macro($name, $callback);
Calling Macros
MyClass::macro('myMethod', function(): bool { return true; }); new MyClass()->myMethod(); // true
Static Macros
You can attach Fyre\Utility\Traits\StaticMacroTrait to any class.
use Fyre\Utility\Traits\StaticMacroTrait; // in any class class MyClass { use StaticMacroTrait; }
Clear Static Macros
Clear all static macros.
MyClass::clearStaticMacros();
Has Static Macro
Determine whether a static macro is registered.
$nameis a string representing the name of the macro.
$hasStaticMacro = MyClass::hasStaticMacro($name);
Static Macro
Register a static macro.
$nameis a string representing the name of the macro.$callbackis the macro callback.
MyClass::staticMacro($name, $callback);
Calling Static Macros
MyClass::staticMacro('myMethod', function(): bool { return true; }); MyClass::myMethod(); // true
统计信息
- 总下载量: 1.98k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 49
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-27