mmouih/entity-generator
最新稳定版本:v1.0.2
Composer 安装命令:
composer require --dev mmouih/entity-generator
包简介
A tool designed to streamline the conversion of payloads (json, xml or yaml) into class entities
README 文档
README
The Entity Generator is a tool designed to streamline the conversion of payloads into class entities for PHP applications running on PHP 7 and beyond. The generated entities adhere to the PSR-12 coding standards, ensuring a clean and consistent codebase.
This tool is particularly valuable for swiftly transforming payloads into Data Transfer Objects (DTOs), enhancing your PHP application's flexibility and efficiency.
Requirements
- PHP 8.2 or higher
Usage
To leverage the Entity Generator, use the following command:
Using Json file
./phpgen generate [EntityName] [Payload] --f
Using Json string
./phpgen generate [EntityName] [Json] "json"
Or simply
./phpgen generate [EntityName] [Json]
Example:
./phpgen generate User '{"id": 1, "label": "john"}'
Using XML file
./phpgen generate [EntityName] [filepath] "xml" -f
Using XML string
./phpgen generate [EntityName] [XML] "xml"
Using Yaml file
./phpgen generate [EntityName] [filepath] "xml" -f
Configuration file
You can use customized entity generation options using a configuration a below,
#config.yaml.dist entity.generator: output.dir: 'var/generated' namespace: 'Entity\Generated' property.phpdoc: true property.type: true # false before php7.4
./phpgen generate [EntityName] [filepath] "xml" -f -c path/to/config.yaml.dist
If config file is not configured, default options (config.yaml.dist) will be used.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-30