mphpmaster/dto-generator
最新稳定版本:1.1.0
Composer 安装命令:
composer create-project mphpmaster/dto-generator
包简介
DataTransferObjects file generator.
README 文档
README
A simple Bash script to generate Data Transfer Object (DTO) files. The script allows you to specify the namespace, model name, and directory for your DTO files, and optionally create a base DTO class.
Table of Contents
Installation
Using Composer
To install the script globally using Composer, run:
composer global require mPhpMaster/dto-generator
Manual Installation
-
Clone the repository:
git clone https://github.com/mPhpMaster/dto-generator.git
-
Make the script executable:
chmod +x dto
-
Move the script to a directory in your PATH, for example:
sudo mv dto /usr/local/bin/dto
Usage
To generate a DTO file, use the following command:
dto [options] [model]
Options
-h,--help: Show this help message.--namespace=<ns>: Optional namespace (default is empty).-B,--base: CreateBaseDTO.php.-f,--force: Force overwrite of existing files.--dir=<dir>: Directory to create (default isapp/DataTransferObjects).
Arguments
model: Model name (default isUserDTO).
Examples
Generate a DTO with Default Settings
dto
This will generate a UserDTO.php in the app/DataTransferObjects directory with no namespace.
Generate a DTO with a Custom Model Name
dto MyModel
This will generate MyModel.php in the app/DataTransferObjects directory.
Generate a DTO with a Namespace
dto --namespace=App\\DTO MyModel
This will generate MyModel.php in the app/DataTransferObjects directory with the namespace App\DTO.
Create a Base DTO Class
dto --base
This will create a BaseDTO.php file in the app/DataTransferObjects directory.
Specify a Different Directory
dto --dir=src/DTO MyModel
This will generate MyModel.php in the src/DTO directory.
Force Overwrite Existing Files
dto --force MyModel
This will overwrite MyModel.php if it already exists.
License
This project is licensed under the MIT License. See the LICENSE file for details.
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-01