Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vumanskyi/dataobjectconvert
Convert json or yaml to php DTO or Entity
https://github.com/vumanskyi/dataobjectconvert
Last synced: 6 days ago
JSON representation
Convert json or yaml to php DTO or Entity
- Host: GitHub
- URL: https://github.com/vumanskyi/dataobjectconvert
- Owner: vumanskyi
- License: mit
- Created: 2023-10-28T14:27:11.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-31T18:38:20.000Z (about 1 year ago)
- Last Synced: 2024-11-17T06:42:26.943Z (2 months ago)
- Language: Go
- Homepage:
- Size: 2.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Data Object Converter
The CLI tool to turn JSON and YAML objects into Data Object (PHP)
There are two types of object: entity and data transfer object.
## Usage
Convert **json** structure to php data object
```
data-object-convert json -c PersonDto "{\"name\": \"John\", \"age\": 30, \"cost\": 30.20}"
```Result:
```
name = name;
$this->age = age;
$this->cost = cost;
}public function getAge(): int
{
return $this->age;
}public function getCost(): float
{
return $this->cost;
}public function getName(): string
{
return $this->name;
}}
```
Convert **yaml** structure to php data object
```
data-object-convert yaml -t entity -c PersonEntity "
name: John
age: 30
cost: 30.20
"
```Result:
```
name = $name;
return $this;
}public function getName(): string
{
return $this->name;
}public function setAge(int $age): self
{
return $this->age = $age;
return $this;
}public function getAge(): int
{
return $this->age;
}public function setCost(float $cost): self
{
return $this->cost = $cost;
return $this;
}public function getCost(): float
{
return $this->cost;
}}
```