troytft/mapper
最新稳定版本:v2.1.0
Composer 安装命令:
composer require troytft/mapper
包简介
Mapper is a PHP library for mapping data to objects, type of property can be configured by annotation
关键字:
README 文档
README
Mapper is a PHP library for mapping data to objects, type of property can be configured by annotation
Features
- Supports scalar types: integer, float, boolean, string
- Supports any nesting level using object and collection types
- Supports work with dates
- Allows write your own types
- Allows define nullability of property
Usage
<?php use Mapper\Annotation as Mapper; use Mapper\ModelInterface; class Movie implements ModelInterface { /** * @var string * * @Mapper\StringType() */ private $name; /** * @var Release[]|null * * @Mapper\CollectionType(type=@Mapper\ObjectType(class="Model\Release"), nullable=true) */ private $releases; ... getters and setters } $model = new Movie(); $data = [ 'name' => 'Taxi 2', 'releases' => [ [ 'country' => 'France', 'date' => '2000-03-25' ], ] ]; $mapper->map($model, $data);
Requirements
- PHP 7.4 or higher
Installation
composer require troytft/mapper
Documentation
Full documentation can be found at docs/main.md
统计信息
- 总下载量: 7.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2019-09-04