PHPackages                             hectorqin/thinkphp-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. hectorqin/thinkphp-generator

ActiveThink-extend[Utility &amp; Helpers](/categories/utility)

hectorqin/thinkphp-generator
============================

Generate model,controller,validate with parsing database.

v1.0.1(6y ago)1332↓87.5%Apache-2.0PHP

Since Jul 25Pushed 6y agoCompare

[ Source](https://github.com/hectorqin/thinkphp-generator)[ Packagist](https://packagist.org/packages/hectorqin/thinkphp-generator)[ RSS](/packages/hectorqin-thinkphp-generator/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

thinkphp-generator
==================

[](#thinkphp-generator)

命令行自动生成数据表模型、校验器、控制器等

框架要求
----

[](#框架要求)

ThinkPHP5.1+

安装
--

[](#安装)

```
composer require hectorqin/thinkphp-generator
```

配置
--

[](#配置)

修改项目根目录下config/generator.php中对应的参数

使用
--

[](#使用)

```
# 帮助
$ php think generate --help
Usage:
  generate [options]

Options:
  -c, --config[=CONFIG]              配置名称，默认为 generator [default: "generator"]
  -t, --table[=TABLE]                要生成的table，多个用,隔开, 默认为所有table
  -p, --tablePrefix[=TABLEPREFIX]    table前缀，多个用,隔开
  -i, --ignoreFields[=IGNOREFIELDS]  忽略的字段，不生成搜索器
  -e, --except[=EXCEPT]              要排除的table，多个用,隔开
      --type[=TYPE]                  要生成的类型，多个用,隔开,如 m,v,c,p,s,d
                                            m -- model, v -- validate, c -- controller, p -- postmanJson, s -- searchAttr, d -- model doc
      --templateDir[=TEMPLATEDIR]    自定义模板文件夹路径，必须有 model.tpl,
                                     controller.tpl, validate.tpl等文件，使用tp模板语法
      --mModule[=MMODULE]            模型模块名
      --vModule[=VMODULE]            校验器模块名
      --cModule[=CMODULE]            控制器模块名
      --mLayer[=MLAYER]              模型分层
      --vLayer[=VLAYER]              校验器分层
      --cLayer[=CLAYER]              控制器分层
      --mBase[=MBASE]                模型继承类，如 app\common\model\EventModel
      --vBase[=VBASE]                校验器继承
      --cBase[=CBASE]                控制器继承类
      --db[=DB]                      数据库配置文件名
      --dryRun[=DRYRUN]              只执行，不保存 [default: false]
  -f, --force[=FORCE]                覆盖已存在文件 [default: false]
      --pName[=PNAME]                PostMan 项目名称，默认使用 数据库名
      --pHost[=PHOST]                PostMan API请求前缀，默认使用 api_prefix 环境变量
  -h, --help                         Display this help message
  -V, --version                      Display this console version
  -q, --quiet                        Do not output any message
      --ansi                         Force ANSI output
      --no-ansi                      Disable ANSI output
  -n, --no-interaction               Do not ask any interactive question
  -v|vv|vvv, --verbose               Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

# 生成 user 表模型、校验器、控制器
php think generate -t user --type=m,v,c

# 生成数据库全部数据表的模型、校验器、控制器
php think generate --type=m,v,c

# 不生成，预览操作
php think generate --type=m,v,c -d
```

License
-------

[](#license)

Apache-2.0

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2490d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b8a54eac6e1f748bc947581efd89a684838353116927057f5c98937fb1888c6?d=identicon)[hectorqin](/maintainers/hectorqin)

---

Tags

generate-codegenerate-controllergenerate-modelgenerate-valiadatethinkphp

### Embed Badge

![Health badge](/badges/hectorqin-thinkphp-generator/health.svg)

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

###  Alternatives

[topthink/think-captcha

captcha package for thinkphp

132934.4k68](/packages/topthink-think-captcha)[topthink/think-worker

workerman extend for thinkphp

202227.2k9](/packages/topthink-think-worker)[yunwuxin/think-cron

计划任务

17416.2k](/packages/yunwuxin-think-cron)[zzstudio/think-addons

The ThinkPHP6 Addons Package

1518.6k](/packages/zzstudio-think-addons)[topthink/think-annotation

Annotation For ThinkPHP

4831.5k8](/packages/topthink-think-annotation)[liliuwei/thinkphp-jump

适用于thinkphp6.0的跳转扩展

2874.4k1](/packages/liliuwei-thinkphp-jump)

PHPackages © 2026

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