akbsit/trait-dto
最新稳定版本:1.0.3
Composer 安装命令:
composer require akbsit/trait-dto
包简介
Trait help to create dto objects.
README 文档
README
Install
To install package, you need run command:
composer require akbsit/trait-dto
Example
Create DTO class with trait DtoTrait:
<?php namespace App\Classes; use Akbsit\TraitDto\DtoTrait; /** * Class ExampleDto * @package App\Classes */ class ExampleDto { use DtoTrait; /* @var int */ public $iIntProperty; /* @var string */ public $sStringProperty; /* @var array */ public $arArrayProperty; }
Create object:
$oExampleDto = ExampleDto::instance()->create([ 'iIntProperty' => 10, 'sStringProperty' => 'string', 'arArrayProperty' => [ 'key1' => 'value1', 'key2' => 'value2', ], ]);
object(App\Classes\ExampleDto)#208 (3) {
["iIntProperty"]=>
int(10)
["sStringProperty"]=>
string(6) "string"
["arArrayProperty"]=>
array(2) {
["key1"]=>
string(6) "value1"
["key2"]=>
string(6) "value2"
}
}
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-16