wearelaradev/callables
Composer 安装命令:
composer require wearelaradev/callables
包简介
Callables trait
README 文档
README
This php package allows any php object to create magic getter, setter and adder functions. This avoids creating a multitude of methods that are not always optimal to read.
Getting started
composer require wearelaradev/callables
Usage
use Laradev\Callables\Callables; class MyObject { use Callables; public string $foo = "foo"; protected string $bar = "bar"; private string $toto = "toto"; private array $arr = []; } var_dump((new MyObject())->getBar()); //output: "bar" $obj = (new MyObject()) ->setFoo("foo1") ->setToto("toto1") ->addArr("test") ; var_dump(["foo" => $obj->getFoo(), "toto" => $obj->getToto(), "arr" => $obj->getArr()]); // output: ["foo" => "foo1", "toto" => "toto1", "arr" => ["test"]];
Additional information
If you encounter a bug or have any ideas for improvement, don't hesitate to send me a PR or contact me via email at florian@laradev.ca :)
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: mit
- 更新时间: 2024-04-11