coksnuss/yii2-gii-modelgen
Composer 安装命令:
composer require coksnuss/yii2-gii-modelgen
包简介
A tweaked model generator for the Gii module of the Yii 2 framework.
关键字:
README 文档
README
A tweaked model generator for the Gii module of the Yii 2 framework. The generator re-uses Gii-native code wherever possible and thus has a high chance of retaining all the latest changes of Gii without the need for an update. When checked for the last time, the generator retains the full featureset of Gii 2.0.8.
What this extension does
This extension basically adds three features to gii's basic model template generator:
- The generated models are splitted into a base model and a concrete model. Whenever the database structure is changed (e.g. through a migration) the base model can simply be overridden by the newly generated model. No custom code is touched. All custom code is written into the concrete model which is used throughout the application and extends the base model.
- A new option is added to directly integrate the timestamp behavior into models by providing the column names of the created_at and updated_at column.
- When generating models for all tables using the wildcard operator
*the migration table is omitted. In addition to the model class, it is possible to generate a query class.(This feature is now natively supported by Gii)
In addition, the template files were slightly adapted:
- The
tableName()function within the generated model classes is only generated if it is required, i.e., if default implementation ofActiveRecord::tableName()is insufficient. - When generating a query class, it does not contain any boilerplate functions.
Installation
First this extension needs to be included via composer by issuing the following console command within the root directory of your yii2 project:
composer require --prefer-dist "coksnuss/yii2-gii-modelgen"
Furthermore Gii needs to know of the newly available model template. This is achieved by modifying the corresponding configuration file
[...]
'class' => 'yii\gii\Module',
'generators' => [
'model' => ['class' => 'coksnuss\gii\modelgen\generators\model\Generator'],
],
[...]
Thats it.
coksnuss/yii2-gii-modelgen 适用场景与选型建议
coksnuss/yii2-gii-modelgen 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.63k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2014 年 11 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yii2」 「gii」 「model template」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 coksnuss/yii2-gii-modelgen 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coksnuss/yii2-gii-modelgen 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 coksnuss/yii2-gii-modelgen 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Gii Generator for double model generation
A custom URL rule class for Yii 2 which allows to create translated URL rules
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Interfaces for web resource models and services to retrieve and create them
The Gii extension for the Yii framework
Laravel 5 - Repositories to the database layer
统计信息
- 总下载量: 2.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-11-30