Download the PHP package mphpmaster/dto-generator without Composer
On this page you can find all versions of the php package mphpmaster/dto-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mphpmaster/dto-generator
More information about mphpmaster/dto-generator
Files in mphpmaster/dto-generator
Package dto-generator
Short Description DataTransferObjects file generator.
License MIT
Homepage https://github.com/mPhpMaster/dto-generator
Informations about the package dto-generator
DTO Generator
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
- Usage
- Options
- Arguments
- Examples
- License
Installation
Using Composer
To install the script globally using Composer, run:
Manual Installation
-
Clone the repository:
-
Make the script executable:
- Move the script to a directory in your PATH, for example:
Usage
To generate a DTO file, use the following command:
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
This will generate a UserDTO.php
in the app/DataTransferObjects
directory with no namespace.
Generate a DTO with a Custom Model Name
This will generate MyModel.php
in the app/DataTransferObjects
directory.
Generate a DTO with a Namespace
This will generate MyModel.php
in the app/DataTransferObjects
directory with the namespace App\DTO
.
Create a Base DTO Class
This will create a BaseDTO.php
file in the app/DataTransferObjects
directory.
Specify a Different Directory
This will generate MyModel.php
in the src/DTO
directory.
Force Overwrite Existing Files
This will overwrite MyModel.php
if it already exists.
License
This project is licensed under the MIT License. See the LICENSE file for details.