1. Go to this page and download the library: Download romabeckman/dtophp 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/ */
romabeckman / dtophp example snippets
class UserInDto extends InDto {
/**
* @rule *
* @rule * @rule * @var array
*/
private $foods;
function getName(): string { return $this->name; }
function getEmail(): string { return $this->email; }
function getAddress(): AddressInDto { return $this->address; }
function getAge(): int { return $this->age; }
function getFoods(): array { return $this->foods; }
function setName(string $name): void { $this->name = $name; }
function setEmail(string $email): void { $this->email = $email; }
function setAddress(AddressInDto $address): void { $this->address = $address; }
function setAge(int $age): void { $this->age = $age; }
function setFoods(array $foods): void { $this->foods = $foods; }
}
class AddressInDto extends InDto {
/**
* @rule
//Configuring class to validation
DTOPHP\Configuration::setValidatorEngine('MyNameSpace\To\LaravelValidator');