wrkflow/php-get-typed-value
最新稳定版本:v0.8.4
Composer 安装命令:
composer require wrkflow/php-get-typed-value
包简介
Get typed (strict mode) values from an Array / XML with basic validation.
README 文档
README
Get typed (strict mode) values from an Array / XML with basic validation.
composer require wrkflow/php-get-typed-value
Main features
- 🚀 Retrieve values from Array (JSON) / XML with correct return type with safe dot notation support.
- 🏆 Makes PHPStan / IDE happy due the type strict return types.
- 🤹 Validation: Ensures that desired value is in correct type (without additional loop validation).
- 🛠 Transformers: Ensures that values are in expected type.
- ⛑ Converts empty string values to null (can be disabled, see transformers).
use Wrkflow\GetValue\GetValue; use Wrkflow\GetValue\DataHolders\ArrayData; $data = new GetValue(new ArrayData([ 'address' => [ 'street' => [ 'number' => '13', ], 'name' => '', ] ])); $data->getInt('address.street.number') // Returns: 13 (int) $data->getString('address.street.name') // Returns: null because value does not exists $data->getRequiredString('address.street.name') // Returns: throws MissingValueForKeyException exception
Documentation
Documentation is hosted on GitHub Pages.
Comment
I've created this project as part of my mission to create work flow tools / libraries to make my (and yours) dev
life easier and more enjoyable.
Want more tools or want to help? Check wrk-flow.com or CONTRIBUTE. You can help me improve the documentation, add new tests and features. Are you junior developer? Don't be scared, get in touch and I will guide you in your first contribution.
统计信息
- 总下载量: 4.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-27