承接 wearelaradev/callables 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: mit
  • 更新时间: 2024-04-11