PHP code example of falbar / trait-dto
1. Go to this page and download the library: Download falbar/trait-dto library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
falbar / trait-dto example snippets
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;
}
$oExampleDto = ExampleDto::instance()->create([
'iIntProperty' => 10,
'sStringProperty' => 'string',
'arArrayProperty' => [
'key1' => 'value1',
'key2' => 'value2',
],
]);