Download the PHP package funson86/yii2-gii without Composer

On this page you can find all versions of the php package funson86/yii2-gii. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-gii

Yii2-gii for Chinese

主要针对中文和项目的优化

default模板

Model

  1. 在model.php头部增加$labelList = ['type', 'kind']; 如果其他需要生成getXXXLabels函数会自动生成,适用于需要定义常量的字段。
  2. 增加beforeSave和afterSave两个函数,默认为注释掉的
  3. 增加model保存时自动附加时间和操作用户TimestampBehavior::className(),BlameableBehavior::className(),
  4. 增加getImportFields和getExportFields两个函数,用于指定导入导出csv对应的类型,类型暂时支持relation/enum/int/text。‘_id’默认为relation类型,自动转换为该类型的name;enum对应$labelList中所指定,自动对应getXxxLabels中标签;int对应字段类型为integer或boolean;其他为text类型。
  5. 在controller.php头部增加$importPrimary,用来判定导入时候为新增数据还是更新数据,支持通过数组方式指定类型,类型和上述一致enum/relation/text/int/decimal。

CRUD

Controller

  1. 针对鉴权提供can函数
  2. 对actionDelete增加软删除,即将状态设置为STATUS_DELETE状态
  3. search.php增加排序,默认按照create_at降序,可启用按照sort_order升序, create_at降序
  4. 增加import和export函数,对应controller-id/import和controller-id/export路由,如果需要对导入文件做严格的检查,修改if (false/empty($result[$i][0]) || empty($result[$i][1])/) { 部分代码。
  5. 导入的模板需要放在backend/web/template/table.csv文件

Views

  1. 在index.php _form.php view.php文件的头部有$labelList = ['type', 'kind']; 在index中会使用标签以及生成下拉列表筛选, 表单中增加下拉列表 view中会转换成对应的标签
  2. index、view中所有的‘_at’结尾的字段转变成时间字符串,所有的‘_by’会显示成user表中的username,且以这两个不会在表单中出现,自动使用model中的
  3. 所有以‘_id’结尾的字段,都会对前面的字段进行处理成相关model中的name字段,对于user表则显示为username字段。index、view中显示name内容,form表中显示成id=>name下拉列表
  4. 如果有‘status’字段,都会解析成common\models\Status中的标签。index、view中显示标签,form表变成下拉列表
  5. 如果以‘_status’结尾的字段,则会解析成当前model中对应的getXxxStatusLabels函数中的标签,form表变成下拉列表

数据表设计

  1. 除parent_id外,所有的以‘_id’结尾的字段需要定义外键
  2. 所有的状态使用‘status’或者以‘_status’结尾
  3. 最好加上created_at,updated_at,created_by,updated_by
  4. 需要常量的字段在model.php index.php _form.php view.php中添加到$labelList中

所有的表格最好以一下方式结尾

一个常用的表:

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

在main-local.php中配置:

在gii新建模板时会多出一个选项。

如果要统一输出显示的日期时间格式,修改config/main.php

一些小技巧参考  tips


All versions of yii2-gii with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package funson86/yii2-gii contains the following files

Loading the files please wait ....