https://github.com/sensorario/dto
https://github.com/sensorario/dto
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sensorario/dto
- Owner: sensorario
- Created: 2017-06-08T22:51:31.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-12T07:13:36.000Z (about 9 years ago)
- Last Synced: 2025-06-01T05:10:27.592Z (about 1 year ago)
- Language: PHP
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dto
Given a Dto like this:
```
class Person extends Dto
{
public $name;
public $surname;
}
```
## available property names
Person::getPropertyNames(); // [ 'name', 'surname', ];
## properties accessibility
$dto = Person::createFromArray([ 'name' => 'Simone', ]);
$dto->get('name'); // 'Simone'
## properties as array
$dto = Person::createFromArray([
'name' => 'Simone',
'surname' => 'Gentili',
]);
$dto->asArray(); // [ 'name' => 'Simone', 'surname' => 'Gentili', ];