PHPackages                             mehrshaddarzi/wp-cli-trait-command - 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. [CLI &amp; Console](/categories/cli)
4. /
5. mehrshaddarzi/wp-cli-trait-command

ActiveWp-cli-package[CLI &amp; Console](/categories/cli)

mehrshaddarzi/wp-cli-trait-command
==================================

WP-CLI Trait Package Command.

v1.0.4(3y ago)234[1 issues](https://github.com/mehrshaddarzi/wp-cli-trait-command/issues)MITPHPPHP ^5.6 || ^7.0 || ^8.0

Since Oct 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mehrshaddarzi/wp-cli-trait-command)[ Packagist](https://packagist.org/packages/mehrshaddarzi/wp-cli-trait-command)[ Docs](https://github.com/mehrshaddarzi/wp-cli-trait-command)[ RSS](/packages/mehrshaddarzi-wp-cli-trait-command/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

WP-CLI Trait Package Command
============================

[](#wp-cli-trait-package-command)

[![Packagist](https://camo.githubusercontent.com/94257174d43ea01847b2a52eaf5fa4c62552a0a7f447664ac9b87ea7224a4fa5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d656872736861646461727a692f77702d636c692d74726169742d636f6d6d616e64)](https://camo.githubusercontent.com/94257174d43ea01847b2a52eaf5fa4c62552a0a7f447664ac9b87ea7224a4fa5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d656872736861646461727a692f77702d636c692d74726169742d636f6d6d616e64)[![Packagist Version](https://camo.githubusercontent.com/3d09c76671717833e8f7b9b07c7ecf1c78c81e17be8f87d20c6d9e85a4805034/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6d656872736861646461727a692f77702d636c692d74726169742d636f6d6d616e64)](https://camo.githubusercontent.com/3d09c76671717833e8f7b9b07c7ecf1c78c81e17be8f87d20c6d9e85a4805034/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6d656872736861646461727a692f77702d636c692d74726169742d636f6d6d616e64)[![GitHub repo size](https://camo.githubusercontent.com/ed4e2e5a4ccf7136cf6c86e123cc17fdb986e972678f353ee268a4a3f0d59c81/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6d656872736861646461727a692f77702d636c692d74726169742d636f6d6d616e64)](https://camo.githubusercontent.com/ed4e2e5a4ccf7136cf6c86e123cc17fdb986e972678f353ee268a4a3f0d59c81/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6d656872736861646461727a692f77702d636c692d74726169742d636f6d6d616e64)

Generate plugin or php model files e.g. post-type or taxonomy for [WP-Trait](https://github.com/mehrshaddarzi/wp-trait) Package in Develop WordPress Plugin.

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

[](#installation)

You can install this package with:

```
wp package install mehrshaddarzi/wp-cli-trait-command
```

> Installing this package requires WP-CLI v2 or greater. Update to the latest stable release with `wp cli update`.

Structure
---------

[](#structure)

```
NAME

  wp trait

DESCRIPTION

  WP-CLI Trait Package Command.

SYNOPSIS

  wp trait

SUBCOMMANDS

  add         Add Custom Package.
  make        Generate Model Files.
  remove      Remove Custom Package.
  start       Generates starter code for a plugin

```

### Generate Plugin

[](#generate-plugin)

Use This Command:

```
wp trait start
```

And fill Your Plugin information e.g. slug and namespace:

```
1/12 [--slug=]: wp-plugin
2/12 [--namespace=]: WP_Plugin
3/12 [--plugin_name=]: plugin-name
4/12 [--plugin_description=]: your plugin description
5/12 [--plugin_author=]: Mehrshad Darzi
6/12 [--plugin_author_uri=]: https://profiles.wordpress.org/mehrshaddarzi/
7/12 [--plugin_uri=]: https://github.com/mehrshaddarzi/wp-trait
8/12 [--skip-tests] (Y/n): n
9/12 [--ci=]: travis
10/12 [--activate] (Y/n): y
11/12 [--activate-network] (Y/n): n
12/12 [--force] (Y/n): y

```

### Make PHP Model

[](#make-php-model)

Create php model:

```
wp trait make model
```

> Notice: To execute the command to create a model or post-type, you must change the directory of your terminal address from the WordPress root to the plugin folder. for example first run `cd wp-content/plugins/my-plugin` command and then run `wp trait make`

#### Create Model With Class Name:

[](#create-model-with-class-name)

```
wp trait make model Option
```

#### Create Model With Nested Namespace:

[](#create-model-with-nested-namespace)

```
wp trait make model User/Register
```

#### Create Model With Custom global Variable in Plugin:

[](#create-model-with-custom-global-variable-in-plugin)

```
wp trait make model User/Signup --var=register
```

### Make WordPress Post Type

[](#make-wordpress-post-type)

Make a new post-type in WordPress:

```
wp trait make post-type
```

#### Create A new Post Type With `City` slug:

[](#create-a-new-post-type-with-city-slug)

```
wp trait make post-type City
```

After created You can change `register_post_type` argument in main plugin files.

#### Create a new Post Type With Nested NameSpace:

[](#create-a-new-post-type-with-nested-namespace)

```
wp trait make post-type Post/Orders order
```

### Make WordPress Taxonomy

[](#make-wordpress-taxonomy)

Make a new taxonomy in WordPress:

```
wp trait make taxonomy
```

#### Create A new Taxonomy With `Country` slug:

[](#create-a-new-taxonomy-with-country-slug)

```
wp trait make taxonomy Country
```

After create You can change register\_taxonomy argument in main plugin files.

#### Create a new Taxonomy With Nested NameSpace and Custom name:

[](#create-a-new-taxonomy-with-nested-namespace-and-custom-name)

```
wp trait make taxonomy Media/Category media_cat Category
```

### Add or Remove Package

[](#add-or-remove-package)

```
wp trait add
```

```
wp trait remove
```

#### List Of Trait Package

[](#list-of-trait-package)

packagedescriptionide-helperCreate WP-Trait method helper for developer in IDE software e.g. PHPStormcmb2Add [CMB2](https://github.com/CMB2/CMB2) Framework to your pluginAuthor
------

[](#author)

- [Mehrshad Darzi](https://www.linkedin.com/in/mehrshaddarzi/) | PHP Full Stack and WordPress Expert

Contributing
------------

[](#contributing)

We appreciate you taking the initiative to contribute to this project.

Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

### Reporting a bug

[](#reporting-a-bug)

Think you’ve found a bug? We’d love for you to help us get it fixed. Before you create a new issue, you should [search existing issues](https://github.com/mehrshaddarzi/wp-cli-trait-command/issues) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.

### Creating a pull request

[](#creating-a-pull-request)

Want to contribute a new feature? Please first [open a new issue](https://github.com/mehrshaddarzi/wp-cli-trait-command/issues/new) to discuss whether the feature is a good fit for the project.

Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience:

1. Create a feature branch for each contribution.
2. Submit your pull request early for feedback.
3. Follow [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~169 days

Total

4

Last Release

1176d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b468d7958e961014f669dbba52acfdec695c5c200792c4f4d85f8131d8a99c0c?d=identicon)[mehrshaddarzi](/maintainers/mehrshaddarzi)

---

Top Contributors

[![mehrshaddarzi](https://avatars.githubusercontent.com/u/949491?v=4)](https://github.com/mehrshaddarzi "mehrshaddarzi (19 commits)")

---

Tags

wordpress-pluginwp-cliwp-cli-commandwp-cli-packagecliwordpresswp-cli

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mehrshaddarzi-wp-cli-trait-command/health.svg)

```
[![Health](https://phpackages.com/badges/mehrshaddarzi-wp-cli-trait-command/health.svg)](https://phpackages.com/packages/mehrshaddarzi-wp-cli-trait-command)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[wp-cli/wp-cli-bundle

WP-CLI bundle package with default commands.

896.3M131](/packages/wp-cli-wp-cli-bundle)[wpsh/wp-cli-replicator

3581.7k](/packages/wpsh-wp-cli-replicator)[wearerequired/wp-cli-clear-opcache

Use WP-CLI to clear the OPcache for a site via HTTP.

1735.6k](/packages/wearerequired-wp-cli-clear-opcache)

PHPackages © 2026

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