schmunk42/yii2-giiant Gii CRUD generator for Yii 2 Framework

giicrud

yii2-giiant

"Giiant is huge!"

Build Status

What is this?

Giiant is an extended code-generator for models and CRUDs, based upon Gii (Yii 2.0 Framework).

It creates prototypes for database models and backends including relations defined by foreign-key constrains in no-time.

To provide a highly flexible configuration system it features a callback-provider-queue to define rendering of customized inputs, columns or attribute values.

A main project goal is porting many features and learnings from gtc, giix, awecrud and other code-generators into one solution.

Resources

Features

Batch command

  • yii batch creates all models and/or CRUDs for a set of tables sequentially with a single command

Model generator

  • generates separate model classes to customize and base models classes which can be regenerated on schema changes
  • table prefixes can be stripped off model class names (not bound to db connection settings from Yii 2.0)

CRUD generator

  • input, attribute, column and relation customization with provider queues
  • callback provider to inject any kind of code for inputs, attributes and columns via dependency injection
  • virtual-relation support (non-foreign key relations)
  • model, view and controller locations can be customized to use subfolders
  • horizontal and vertical form layout
  • options for tidying generated code
  • action button class customization (Select "App Class" option on the Action Button Class option on CRUD generator to customize)

Installation

The preferred way to install this extension is through composer.

Using a stable version

composer require schmunk42/yii2-giiant:"@stable"

Using latest master

composer require schmunk42/yii2-giiant:"@dev"

The generators are registered automatically in the application bootstrap process, if Gii module is enabled.

You can try giiant via phd (dockerized PHP application template).

Configuration

It's recommended to configure a customized batch command in your application CLI configuration.

'controllerMap' => [
    'batch' => [
        'class' => 'schmunk42\giiant\commands\BatchController',
        'overwrite' => true,
        'modelNamespace' => 'app\\modules\\crud\\models',
        'crudTidyOutput' => true,
    ]
],

Note: yii giiant-batch is an alias for the default configuration of BatchController registered by this extension.

You can add the giiant specific configuration config/giiant.php, and include this from your config/main.php.

See the batches section for configuration details.

Usage

To create a full-featured database backend, run the CLI batch command

yii batch

You can still override the settings from the configuration, like selecting specific tables

yii batch --tables=a,list,of,tables

Core commands

Show help for gii

yii help gii

Create application-module for giiant CRUDs

yii gii/giiant-module

The commands for generating models and CRUD, there are usually run via the batch command above.

yii gii/giiant-model
yii gii/giiant-crud

Advanced

Provider usage and configuration via dependency injection

See docs for details.

Using callbacks to provide code-snippets

See docs for details.

Troubleshooting

See docs for known-issues, platform specific usage, quirks, faq, ...

Extras

Special thanks to motin, thyseus, uldisn and rcoelho for their work, inspirations and feedback.

Screenshots

giiant-0 2-screen-1 giiant-0 2-screen-2


Built by dmstr

Changelog

Changelog

1.0.0-beta

  • do not use auto-pluralization in views, pluralize via I18N
  • Improved model generation performance (seemodelCacheRelationsData)
  • updated php-cs-fixer to version 3

0.13.0

  • fixed pivot URLs

0.12.0

  • Added support for modelGenerateJunctionRelationMode
  • Upgraded yiisoft/yii2-gii to version 2.2.0
  • moved JSON form config tog .gii in base directory

0.11.0

  • no changes

0.11.0-beta3

  • fixed multi-table json generation table names
  • fixed module labels for json files
  • pager align in GridView
  • changed icons in index view
  • fixed enum values
  • fixed multi-table model json generation

0.11.0-beta2

  • generateAccessFilterMigrations option
  • dropdown list in GridView filed search filter optimization
  • select position ActionColumn in GridView (left or right)
  • fix view icon in ActionColumn
  • pager align in GridView

0.11.0-beta1

  • added dropdown list in GridView filed search filter
  • allow usage with yiisoft/yii2-gii:^2.1

0.10.8

  • fixed error with php 7.3
  • Correct message category for view action button

0.10.7

  • add baseClassPrefix to model generator.

0.10.6

  • typo of class_exists

0.10.5

  • Update SaveForm.php
  • Additional validation
  • removes reprecated yii2-codeception package deps
  • Update README.md
  • fixed path

0.10.4

  • Fix singularEntities not working when using cli

0.10.3

  • Fix XSS Vulnerability in CRUD views generated

0.10.2

  • Close DB after each model generation
  • added test form view, fixes #230
  • updated docs

0.10.1

  • added tables & skipTables check, refactored skipTables to run in beforeAction
  • Fix #196
  • update for skip db tables

0.10.0

  • added "formLayout" property

0.10.0-beta2

  • updated Object to BaseObject, fixes #220
  • updated dependencies
  • fixed phptidy usage
  • updated yii2-gii constraint to ~2.0.6

0.10.0-beta1

  • applied fixes from #197
  • Fixed spacing in model extended template.
  • updated example database image
  • updated db-test image
  • refactored paths; added missing dependency
  • added legacy yii2-codeception dependency
  • removed generated tester classes
  • refactoring tests
  • specify DB connection component in generated model, if using non-default 'db' (feature of yii2-gii 2.0.0)
  • include modelGenerateRelation attribute into BatchController
  • include attributes for model-generator's timestampBehavior and blameableBehavior into BatchController
  • get has_one relations as tab in model view
  • if no types to filter are given to ModelTrait::getModelRelations (like in generators/crud/default/views/index.php) we should return all types.
  • use relation property instead of relation getter to avoid multiple db queries.
  • moved messages in ‚yii‘ catalog to ‚crud‘ and ‚giiant‘
  • Fix broken URLs on crud relations
  • Fix CallbackProvider examples
  • improved detection of text columns
  • Fixed namespaces in documentation about providers
  • Merge branch 'master' into feature/fix-relation-detection
  • fixed relation detection
  • updated page titles & form-layout

0.9.2

  • updated constraint to allow phptidy on PHP 7
  • updated CLI command infos
  • fixed bootstrap alert class

0.9.1

  • improved detection of database text columns in callbacks
  • fixed #191
  • added basic NOSQL support (tested with elasticsearch)

0.9.0

beta3-beta6

  • added color column example
  • apply cutom model name in UI giiant
  • added icons, relation buttons
  • wrap action column buttons in div
  • enable tidyOuput in batch controller by default
  • generate Access Filter Migrations #179
  • do not overwrite search model class by default; added parameter
  • splitted providers into core and extension providers, getCoreProviders should return core providers only
  • removed hardcoded layout from grid, use DI to configure grid
  • added static callback functions for field and column
  • removed logic from model-extended template, see also #170
  • added kartik gridview to modules in test config
  • updated tests

0.9.0-beta2

  • added catalogue for model related translations to CRUD generator

0.9.0-beta1

  • fixed missing spaces in headlines
  • fixed #141 - removed dependency to dmstr\helpers\Html
  • fixed crud/default/view template, create new related record link param
  • fixed #162
  • added empty merge-with-parent methods for model
  • added separate message categories for model and cruds (batch controller)
  • added route param to permission check - see also https://github.com/dmstr/yii2-web/blob/master/src/User.php
  • added parameter to enable access filter migrations
  • added parameter for controller base traits

0.8.4

  • fixed crud/default/view template, create new related record link param

0.8.3

  • fixed $actionColumnTemplateString in crud default view index.php

0.8.2

  • fixes for message catalogue / translatables
  • SavedForms fix

0.8.1

  • added mission option $useTimestampBehavior, default is true to control the use of yii\behaviors\Timestampbehavior in CLI BatchController for model generation

0.8.0

  • added giiant-extension generator
  • :warning: removed getAliasModel()
  • updated module template
  • fixed form/cli validations

0.7.2

  • fixed copy button

0.7.0-0.7.1

see git log

0.6.1 (2015-12-28)

  • improved test stack isolation
  • fixed and improved tests in CI
  • added access control to REST controller

0.6.0 (2015-12-26)

  • added separate style for default controller (giiant module index view)
  • added upgrading info
  • updated requirements
  • updated dockerized potemkin testing
  • added build message, fixed ENV handling
  • fixed php image version in testing stack
  • Merge pull request #128 from sebathi/master
  • fixed #118
  • added gitlab-ci config
  • Merge pull request #126 from pawelryznar/patch-1
  • create search model directory in batch command
  • fixed model namespace errors; added test generator to module bootstrapping
  • added cmrcx/phptidy dependency
  • removed panel class from views to allow better customization
  • fixed error, when extended controller class contained contents of the base controller
  • fixed #123
  • Merge pull request #119 from gradosevic/master
  • Merge pull request #124 from christophmuth94/master
  • fixed crudProviders paths
  • updated provider example
  • updated installation instructions
  • Added unit tests for GiiantFaker class
  • Implemented crud unit test generator. fixed issue on search model
  • added copy button for records
  • fixed flash messages - use add instead of set (do not overwrite)
  • added phptidy output option
  • fixed detection for database from DI-container
  • flush logs after every loop in batch
  • Merge pull request #117 from christophmuth94/master
  • Editor Provider updated
  • don't skip virtualAttributes by default, added property to change behavior
  • removed legacy code
  • added overwrite check for api controller
  • updated docs
  • added controller namespace property
  • refactored CRUD controllers - split into Controller and BaseController - added REST-ActiveController
  • updated tag for crud navigation buttons - using div, since <ul,ol>s are not allowed inside

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



1.0.0 is the latest of 54 releases



BSD-3-Clause license
Stats
269 github stars & 120 github forks
356 downloads in the last day
9808 downloads in the last 30 days
326291 total downloads