pietmarcus / modeldocgenerator
Eloquent模型的PHPDoc生成器
0.1.6
2017-01-14 13:01 UTC
Requires
- doctrine/dbal: ~2.3
- illuminate/database: 5.*
This package is not auto-updated.
Last update: 2024-09-28 18:16:07 UTC
README
从数据库中的表直接为Eloquent模型创建phpDocs。此包受到了barryvdh在Laravel项目中自动生成模型的phpDocs的启发,并使用了其中的一些代码。
安装
使用以下命令通过composer安装此包
composer require --dev pietmarcus/modeldocgenerator
配置
为此包的设置创建一个配置文件,并将其保存为modeldocgenerator-config.php,位于您的项目根目录中,或者在项目根目录内的配置目录中,内容如下
<?php
use Illuminate\Database\Capsule\Manager as Capsule;
// Define the directory where the models reside.
// Remember to change the value if the config-file is in a config-directory
define('MODELS_DIRECTORY', __DIR__ . '/src/Models');
// Define the root namespace of the models
define('ROOT_NAMESPACE', 'App\Models');
// Load the global settings
$config = require_once __DIR__ . '/src/settings.php';
// Boot Eloquent
$capsule = new Capsule;
$capsule->addConnection($config['settings']['db']);
$capsule->setAsGlobal();
$capsule->bootEloquent();
根据您的项目需要编辑文件。
生成文档
从项目的根目录执行以下命令以运行生成器
vendor\bin\modelDocGenerator
默认情况下,已经具有phpDoc的模型将被跳过。要强制覆盖现有文档,将--overwrite
提供给命令
vendor\bin\modelDocGenerator --overwrite
许可证
Model Doc Generator是开源软件,许可协议为MIT许可证。