itbbn / thinkphp-model-creater
thinkphp模型自动创建类库
6.0.19
2025-09-12 17:22 UTC
Requires
- php: >=7.4.0
- topthink/think-orm: v2.*
This package is not auto-updated.
Last update: 2025-10-10 17:56:17 UTC
README
仓库地址
https://gitee.com/bird2024/tp-model-creater.git
介绍
thinkphp orm模型自动创建帮助类库
软件架构
软件架构说明
安装教程
使用说明
1.先从composer引入
composer require itbbn/thinkphp-model-creater
2.本地建命令行,例如:“ModelCreator.php” 3.编写命令行配置
<?php
namespace app\command;
use app\command\Base;
class ModelCreator extends Base
{
protected $name = "ModelCreator 模型创建类";
public function main()
{
$this->writeln("开始创建模型");
$this->createOtaModel();
$this->writeln("模型创建完成");
}
private function createOtaModel(): void
{
$otaOption = [
'database' => config('database'),
'app' => [
//命名空间
"namespace" => 'app\\common\\model',
//模型基类命名空间
"baseNamespace" => "base",
//baseModel的类名
"baseModel" => "BaseModel",//注意,名字最好唯一
//模型目录
"path" => "/app/common/model/",
'connection' => "mysql",
//root 目录
"root" => root_path(),
//是否开启调试模式
"debug" => true,
'isThinkPhp' => true,
'thinkPhpDbConnection' => 'mysql',
'baseDir' => '',
],
];
// print_r($otaOption);
echo "开始了";
$modelCreator = new \Itbbn\ThinkphpModelCreater\lib\ModelCreator($otaOption);
echo "当前版本:" . $modelCreator->getVersion() . "\n";
$modelCreator->start();
}
}
4.运行命令行
参与贡献
- Fork 本仓库
- 新建 Feat_xxx 分支
- 提交代码
- 新建 Pull Request