SimpleDTO:移动数据的简单 DTO 对象

时间:2021-06-11 20:33:26
【文件属性】:
文件名称:SimpleDTO:移动数据的简单 DTO 对象
文件大小:6KB
文件格式:ZIP
更新时间:2021-06-11 20:33:26
PHP 简单的DTO 用于移动数据的简单 DTO 对象。 需要 PHP 5.4 ###Practical 用法当返回复杂数据时,可以返回 DTO 而不是返回数组。 class UserService { public function getUsers() { $rows = $this->db->users->get(); return DTO::make($rows); } } 视图或控制器可以使用 DTO 对象来访问数据。 使用 get 方法时无需担心未定义索引错误。 {{ $data->get('name') }} @foreach($data->get('cars') as $car)

{{ $car }}

@endforeach ###Installing 包可以通过 composer 安装。
【文件预览】:
SimpleDTO-master
----composer.json(440B)
----phpunit.xml(547B)
----tests()
--------bootstrap.php(110B)
--------DTOTest.php(3KB)
--------dataset.php(511B)
----LICENSE(1KB)
----src()
--------DTOIterator.php(910B)
--------DTO.php(2KB)
----.gitignore(22B)
----README.md(3KB)

网友评论