felixdorn/property-accessor
Composer 安装命令:
composer require felixdorn/property-accessor
包简介
Read an unaccessible property with a nice helper
README 文档
README
Installation
Requires PHP 8.0.0+
You can install the package via composer:
composer require felixdorn/property-accessor
Usage
use function \Felix\PropertyAccessor\access; class Book { protected string $name = 'Harry Potter'; protected int $isbn = 44081224; } $object = new Book(); access($object, 'isbn'); // returns 44081224 // Properties are injected based on the parameter name passed to the function. access($object, function ($isbn, $name) { return $isbn . ' - ' . $name; }); // returns '44081124 - Harry Potter' access($object, ['isbn', 'name']); // returns ['isbn' => 44081224, 'name' => 'Harry Potter']
Testing
composer test
Property Accessor was created by Félix Dorn under the MIT license.
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-29