You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. Gii Extension for Yii 2
  2. ========================
  3. This extension provides a Web-based code generator, called Gii, for [Yii framework 2.0](http://www.yiiframework.com) applications.
  4. You can use Gii to quickly generate models, forms, modules, CRUD, etc.
  5. For license information check the [LICENSE](LICENSE.md)-file.
  6. Documentation is at [docs/guide/README.md](docs/guide/README.md).
  7. [![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-gii/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-gii)
  8. [![Total Downloads](https://poser.pugx.org/yiisoft/yii2-gii/downloads.png)](https://packagist.org/packages/yiisoft/yii2-gii)
  9. [![Build Status](https://travis-ci.org/yiisoft/yii2-gii.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-gii)
  10. Installation
  11. ------------
  12. The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
  13. Either run
  14. ```
  15. php composer.phar require --dev --prefer-dist yiisoft/yii2-gii
  16. ```
  17. or add
  18. ```
  19. "yiisoft/yii2-gii": "~2.0.0"
  20. ```
  21. to the require-dev section of your `composer.json` file.
  22. Usage
  23. -----
  24. Once the extension is installed, simply modify your application configuration as follows:
  25. ```php
  26. return [
  27. 'bootstrap' => ['gii'],
  28. 'modules' => [
  29. 'gii' => [
  30. 'class' => 'yii\gii\Module',
  31. ],
  32. // ...
  33. ],
  34. // ...
  35. ];
  36. ```
  37. You can then access Gii through the following URL:
  38. ```
  39. http://localhost/path/to/index.php?r=gii
  40. ```
  41. or if you have enabled pretty URLs, you may use the following URL:
  42. ```
  43. http://localhost/path/to/index.php/gii
  44. ```
  45. Using the same configuration for your console application, you will also be able to access Gii via
  46. command line as follows,
  47. ```
  48. # change path to your application's base path
  49. cd path/to/AppBasePath
  50. # show help information about Gii
  51. yii help gii
  52. # show help information about the model generator in Gii
  53. yii help gii/model
  54. # generate City model from city table
  55. yii gii/model --tableName=city --modelClass=City
  56. ```