2017 © Pedro Peláez
 

yii2-extension yii2-auto-command

Yii 2 command that generates models for a database and apidoc documentation based on code comments.

image

blurrywindows/yii2-auto-command

Yii 2 command that generates models for a database and apidoc documentation based on code comments.

  • Monday, July 3, 2017
  • by blurrywindows
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Yii 2 Auto Command

GitHub tag Packagist Packagist GitHub issues, (*1)

This is a Yii 2 extension (command) that may be used to automatically generate model classes and apidoc documentation. The actions in this command should normally not run on a production server. The actions mentioned here generate files and data that may be used in development or testing. When executing these actions in a production environment, the controller will generate a warning prompt that you may override., (*2)

TABLE OF CONTENTS

FEATURES

  • Generates model classes based on the given database connection.
  • Generates model classes that extend a (custom) base class.
  • Generates apidoc documentation based on apidoc comment blocks in a custom folder.

REQUIREMENTS

  • PHP >= 5.6.0
  • Composer >= 1.1.2 (https://getcomposer.org/)
  • Node.js >= 8.1.0 (https://nodejs.org/en/)
  • apidoc >= 0.17.6 (npm install -g apidoc)

INSTALLATION

composer require blurrywindows/yii2-auto-command, (*3)

CONFIGURATION

Add the following lines to your console.php configuration:, (*4)

'controllerMap' => [
        'auto' => [
            'class' => 'blurrywindows\AutoCommand\AutoCommand',
            'baseClass' => 'app\models\BaseActiveRecord', // or 'yii\db\ActiveRecord' if you want to use the Yii 2 ActiveRecord as base
            'modelsFolder' => 'models', //Relative to app directory
            'modelsNamespace' => 'app\models',
            'apidocInputFolder' => 'controllers', //Relative to app directory
            'apidocOutputFolder' => 'web/apidoc', //Relative to app directory
            'skipTables' => ['migration'],
        ],
    ],

CONSOLE COMMANDS

./yii auto/all

Executes all the actions in the AutoController., (*5)

./yii auto/gii-models

Generates ActiveRecords for all the tables in your database in your chosen output folder. It automatically overwrites the ActiveRecords if they exist. The ActiveRecords are named Base[Tablename] and extend your chosen baseClass. It also creates a class [Tablename] which extends Base[Tablename] for custom code, extra validation rules, etc. The [Tablename] class will not be overridden when executing the action again., (*6)

./yii auto/apidoc

Generates API documentation based on apidoc from the comments in your chosen input folder. It outputs the documentation in your chosen output folder. You may include this folder in Git if you want to export the documentation to a production server. Please note, apidoc is a dev-dependency in Node.js. It will only be installed when using the npm install command., (*7)

HOW TO CONTRIBUTE

You may contribute in any way you want, but please contact me beforehand to prevent merge-conflicts by creating an issue., (*8)

ISSUES

If you have any questions or experience any issues with this command, please submit an issue., (*9)

READ MORE

  • https://github.com/yiisoft/yii2/blob/master/README.md
  • https://github.com/yiisoft/yii2/tree/master/docs/guide

The Versions

03/07 2017

dev-master

9999999-dev

Yii 2 command that generates models for a database and apidoc documentation based on code comments.

  Sources   Download

MIT

The Requires