PHPackages                             schmunk42/giic - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. schmunk42/giic

ActiveLibrary[CLI &amp; Console](/categories/cli)

schmunk42/giic
==============

Toolset for running Gii on the command line

0.1.4(11y ago)52.3k2[5 issues](https://github.com/schmunk42/giic/issues)BSD-3-ClausePHPPHP &gt;=5.3.0

Since Aug 1Pushed 11y ago3 watchersCompare

[ Source](https://github.com/schmunk42/giic)[ Packagist](https://packagist.org/packages/schmunk42/giic)[ Docs](https://github.com/schmunk42/giic)[ RSS](/packages/schmunk42-giic/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (1)Versions (6)Used By (0)

giic
====

[](#giic)

This package provides a toolset for running Gii on the command line. It runs an unlimited number of pre-configured Gii Generator templates.

Introduction
------------

[](#introduction)

> "I have configured several templates and with Gii I create the code for modules by selecting the templates that is associated with the DB-table. It is working great and saves me lots of time. If I can bash-script or php-script it, it would be awesome."

> "Currently it's not possible and, I'm afraid, will not be possible during all your prototyping stage. "

[unixjunky and Samdark](http://www.yiiframework.com/forum/index.php/topic/11146-gii-functionality-from-command-line/page__view__findpost__p__54687), 2010

**But we made it work!**

How does it work?
-----------------

[](#how-does-it-work)

Giic wraps the Generator and Gii-module in a `GiicApplication`, which is *funky mixture* of `CConsoleApplication`and `CWebApplication`.

You can use a custom [config file](https://github.com/schmunk42/yii-sakila-crud/blob/master/giic-config.php) to specify your input parameters. Every `action` corresponds to a click on the **Generate** button in the web-frontend. Just specify the model attributes as you'd have done in the web application. For more details follow the link in the 'Confiugration' section.

> Note: This code is experimental, please **make a backup** before using it in a project. If you find an issue, please report it [here](https://github.com/schmunk42/giic/issues).

Resources
---------

[](#resources)

- [Yii Framework Extension](http://www.yiiframework.com/extension/giic)
- [GitHub Project](https://github.com/schmunk42/giic)
- [Phundament](http://phundament.com) Package

Installation
------------

[](#installation)

### via composer

[](#via-composer)

```
composer.phar require schmunk42/giic

```

Usage
-----

[](#usage)

```
php vendor/schmunk42/giic/giic.php giic generate alias.to.giic-config

```

Setup
-----

[](#setup)

Giic can be installed in any application, but to get a better impression how it works, we'll guide you through a sample setup with an Yii extension which features CRUDs for the MySQL demo database Sakila.

For the test-drive, we'll install [Phundament](http://phundament.com) together with the Sakila Demo module [schmunk42/yii-sakila-crud](https://github.com/schmunk42/yii-sakila-crud)This module provides migrations and configurations for the MySQL demo database "Sakila" to use with giic. It also includes the generated CRUDs to play around with.

Install a development(!) version Phundament and the demo extension:

```
composer.phar create-project -sdev phundament/app app-crud-test
cd app-crud-test
composer.phar require schmunk42/yii-sakila-crud:@dev

```

> Hint: Standard gii-template-collection usage is preconfigured in Phundament.

Add sakila migrations to `app/config/console-local.php`:

```
'import' => array(
    'vendor.phundament.gii-template-collection.components.*'
),
'aliases' => array(
    'sakila' => 'vendor.schmunk42.yii-sakila-crud.*'
),
'commandMap' => array(
    'migrate' => array(
        // enable eg. data migrations for your local machine
        'modulePaths' => array(
            'sakila'  => 'vendor.schmunk42.yii-sakila-crud.migrations',
        ),
    ),
),

```

Add sakila module and MySQL database to `app/config/main-local.php`:

```
'modules' => array(
    'sakila' => array(
        'class' => 'vendor.schmunk42.yii-sakila-crud.SakilaModule'
    )
),
'components' => array(
    'db'            => array(
        'tablePrefix'      => '',
        'connectionString' => 'mysql:host=localhost;dbname=giic',
        'emulatePrepare'   => true,
        'username' => 'test',
        'password' => 'test',
        'charset'  => 'utf8',
    ),
)

```

Run the migrations to setup the database:

```
app/yiic migrate

```

Because Yii can only create `CConsoleApplication`s we have to use the supplied CLI entry-script to create our hybrid application. Run the following command to invoke the set configured actions:

```
php vendor/schmunk42/giic/giic.php giic generate sakila

```

Your console output should look similar to [this](https://gist.github.com/schmunk42/6124928).

Open  to checkout your CRUDs. Login with `admin` / `admin`.

#### Bonus: giix

[](#bonus-giix)

The config file also looks for giix generators in `application.extensions.giix`, you may download giix and place it into extensions.

### Configuration

[](#configuration)

"The big one" - actions for generating two types of models (gtc &amp; giix) and four types of CRUDs into five different locations.

[See the Sakila Configuration](https://github.com/schmunk42/yii-sakila-crud/blob/master/giic-config.php) checkout the comments for an explanation.

### Troubleshooting

[](#troubleshooting)

- Watch out for XSLT bugs, eg. Entity: line 134: parser error : EntityRef: expecting ';' / Entity nbsp not defined / ...
- If you don't get any errors or output, check your generator templates in your browser in gii
- Set file permission to `777` in `/app/runtime/gii-1.1.13`
- run `composer.phar update` to get the latest packages

### Glitches

[](#glitches)

- All output files are overwritten by default with

    define('GIIC\_ALL\_CONFIRMED', true);

Patch your code model (`GiixModelCode`, `GiixCrudCode`), override this method:

```
public function confirmed($file)
{
    if (defined('GIIC_ALL_CONFIRMED') && GIIC_ALL_CONFIRMED === true) {
        return true;
    } else {
        return parent::confirmed($file);
    }
}

```

> Note: You'll have to patch existing extensions like eg. `giix`

Help is very welcome, send us a [Pull Request](https://github.com/schmunk42/giic/pulls)!

### Tested Generators

[](#tested-generators)

- [gii-template-collection](https://github.com/schmunk42/gii-template-collection) (models and cruds)
- giix (models and cruds)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~108 days

Total

5

Last Release

4234d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b4ab2b6685ec71887908ec8cff261a16cd5bb24c69bb8ab52840e220f175f9d?d=identicon)[schmunk](/maintainers/schmunk)

---

Top Contributors

[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (61 commits)")[![motin](https://avatars.githubusercontent.com/u/793037?v=4)](https://github.com/motin "motin (1 commits)")[![Quexer69](https://avatars.githubusercontent.com/u/3859353?v=4)](https://github.com/Quexer69 "Quexer69 (1 commits)")

---

Tags

cliyiigii

### Embed Badge

![Health badge](/badges/schmunk42-giic/health.svg)

```
[![Health](https://phpackages.com/badges/schmunk42-giic/health.svg)](https://phpackages.com/packages/schmunk42-giic)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[wp-cli/php-cli-tools

Console utilities for PHP

68325.0M367](/packages/wp-cli-php-cli-tools)[socialengine/sniffer-rules

A Lumen 5 and Laravel 5 SquizLabs Code Sniffer 2.0 artisan command. Detect violations of a defined coding standard. It helps your code remains clean and consistent.

1248.2k1](/packages/socialengine-sniffer-rules)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
