PHPackages                             mphpmaster/dto-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mphpmaster/dto-generator

ActiveProject[Utility &amp; Helpers](/categories/utility)

mphpmaster/dto-generator
========================

DataTransferObjects file generator.

1.1.0(2y ago)013MITShell

Since Jul 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/mPhpMaster/dto-generator)[ Packagist](https://packagist.org/packages/mphpmaster/dto-generator)[ Docs](https://github.com/mPhpMaster/dto-generator)[ RSS](/packages/mphpmaster-dto-generator/feed)WikiDiscussions main Synced today

READMEChangelog (5)DependenciesVersions (6)Used By (0)

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
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Options](#options)
- [Arguments](#arguments)
- [Examples](#examples)
- [License](#license)

Installation
------------

[](#installation)

### Using Composer

[](#using-composer)

To install the script globally using Composer, run:

```
composer global require mPhpMaster/dto-generator
```

### Manual Installation

[](#manual-installation)

1. Clone the repository:

    ```
    git clone https://github.com/mPhpMaster/dto-generator.git
    ```
2. Make the script executable:

    ```
    chmod +x dto
    ```
3. Move the script to a directory in your PATH, for example:

    ```
    sudo mv dto /usr/local/bin/dto
    ```

Usage
-----

[](#usage)

To generate a DTO file, use the following command:

```
dto [options] [model]
```

### Options

[](#options)

- `-h`, `--help`: Show this help message.
- `--namespace=`: Optional namespace (default is empty).
- `-B`, `--base`: Create `BaseDTO.php`.
- `-f`, `--force`: Force overwrite of existing files.
- `--dir=`: Directory to create (default is `app/DataTransferObjects`).

### Arguments

[](#arguments)

- `model`: Model name (default is `UserDTO`).

### Examples

[](#examples)

#### Generate a DTO with Default Settings

[](#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

[](#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

[](#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

[](#create-a-base-dto-class)

```
dto --base
```

This will create a `BaseDTO.php` file in the `app/DataTransferObjects` directory.

#### Specify a Different Directory

[](#specify-a-different-directory)

```
dto --dir=src/DTO MyModel
```

This will generate `MyModel.php` in the `src/DTO` directory.

#### Force Overwrite Existing Files

[](#force-overwrite-existing-files)

```
dto --force MyModel
```

This will overwrite `MyModel.php` if it already exists.

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

731d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/59211285?v=4)[Moh. Php Master ..](/maintainers/mPhpMaster)[@mPhpMaster](https://github.com/mPhpMaster)

---

Top Contributors

[![m-alsafadi](https://avatars.githubusercontent.com/u/89378271?v=4)](https://github.com/m-alsafadi "m-alsafadi (8 commits)")[![mPhpMaster](https://avatars.githubusercontent.com/u/59211285?v=4)](https://github.com/mPhpMaster "mPhpMaster (1 commits)")

### Embed Badge

![Health badge](/badges/mphpmaster-dto-generator/health.svg)

```
[![Health](https://phpackages.com/badges/mphpmaster-dto-generator/health.svg)](https://phpackages.com/packages/mphpmaster-dto-generator)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
