boshurik/mapper
最新稳定版本:0.2.2
Composer 安装命令:
composer require boshurik/mapper
包简介
Mapper
README 文档
README
Library for mapping given object to another (e.g. to DTO and back)
Usage
$registry = new MappingRegistry(); $registry->add(User::class, UserDto::class, function(User $user, MapperInterface $mapper, array $context) { $dto = $context[Mapper::DESTINATION_CONTEXT] ?? new UserDto(); $dto->name = $user->getName(); return $dto; }); $mapper = new Mapper($registry); $user = new User('name'); $dto = $mapper->map($user, UserDto::class); // Map to existing object. You can get it from $context[Mapper::DESTINATION_CONTEXT] $dto = $mapper->map($user, new UserDto());
统计信息
- 总下载量: 3.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-23