PHPackages                             phundament/gii-template-collection - 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. [Templating &amp; Views](/categories/templating)
4. /
5. phundament/gii-template-collection

ActiveLibrary[Templating &amp; Views](/categories/templating)

phundament/gii-template-collection
==================================

Gii Template Collection, Model and CRUD templates with Boostrap UI

0.12.6(12y ago)511.4k18[20 issues](https://github.com/schmunk42/gii-template-collection/issues)BSD-3-ClausePHPPHP &gt;=5.3.0

Since Oct 10Pushed 10y ago10 watchersCompare

[ Source](https://github.com/schmunk42/gii-template-collection)[ Packagist](https://packagist.org/packages/phundament/gii-template-collection)[ Docs](http://phundament.com/)[ RSS](/packages/phundament-gii-template-collection/feed)WikiDiscussions develop Synced 3w ago

READMEChangelogDependenciesVersions (38)Used By (0)

gii-template-collection
=======================

[](#gii-template-collection)

### Code templates for Yii 1.1 Framework

[](#code-templates-for-yii-11-framework)

[Fork on github](https://github.com/schmunk42/gii-template-collection)

The gii-template-collection (gtc) contains templates for the Yii Framework Gii module.

**For a Yii 2 port of this project, please visit [giiant](https://github.com/schmunk42/yii2-giiant).**

Features
--------

[](#features)

- relation handling
- YiiBooster integration
- [giic](https://github.com/schmunk42/giic) prove
- customize inputs with code-providers, detect input-type by model and column
    - date and time pickers
    - checkboxes
    - relation widgets
    - editable grid columns
    - partial views
    - enum fields
- multi languages

### Templates

[](#templates)

#### FullModule

[](#fullmodule)

#### FullModel

[](#fullmodel)

##### default

[](#default)

Model Classes in two files `BaseModel`, `Model`

##### singlefile

[](#singlefile)

Standard Model Class `Model`

#### FullCrud

[](#fullcrud)

Note: Relation widgets moved to

##### slim

[](#slim)

Bootstrap UI with relations

##### hybrid

[](#hybrid)

Bootstrap UI with relations and grids

##### slim\_editable

[](#slim_editable)

Screenshots:

[![FullCrud Slim Editable List](sreenshots/FullCrudSlimEditableTrucksList.png)](sreenshots/FullCrudSlimEditableTrucksList.png)

[![FullCrud Slim Editable List](sreenshots/FullCrudSlimEditableTrucksView.png)](sreenshots/FullCrudSlimEditableTrucksView.png)

##### legacy

[](#legacy)

Original gtc CRUDs

Requirements
------------

[](#requirements)

- PHP 5.3 and `short_open_tags = On`

### Notes

[](#notes)

- repo uses [git-flow](https://github.com/nvie/gitflow) naming conventions
- repo follows the guidelines of [semantic versioning](http://semver.org)

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

[](#installation)

Get it via composer:

```
composer.phar require phundament/gii-template-collection

```

or

[Download latest release](https://github.com/schmunk42/gii-template-collection/releases)To use it, simply extract the content of the archive into your application `extensions/` directory.

Setup
-----

[](#setup)

1. Configure the templates in the `generatorPaths` section of the gii configuration inside your application configuration:

    ```
    'gii'=>array(
        'class'=>'system.gii.GiiModule',
        'password'=>'',
        'generatorPaths'=>array(
            'vendor.phundament.gii-template-collection',
        ),
    ),

    ```

    After that, the new generators of gtc should be available in your Gii index page.
2. The last step is to add some gtc components to your import path so they can be found by the application:

    ```
     // autoloading model and component classes
     'import'=>array(
     	// relation widget and save behavior
     	'vendor.phundament.gii-template-collection.components.*',
     ),

    ```
3. For Debugging Information plz add the log under yours config console

    ```
    'components' => array(
        'log'      => array(
            'class'  => 'CLogRouter',
            'routes' => array(
                // file logging
                array(
                    'class'   => 'CFileLogRoute',
                    'logFile' => 'console.log',
                    'levels'  => 'error, warning, info, trace',
                    'enabled' => true,
                ),
            ),
        ),
    ),

    ```

Usage
-----

[](#usage)

### Full Module

[](#full-module)

- open Gii
- select `FullModule`
- enter Module ID
- click `preview`
- click `generate`

### Full Model

[](#full-model)

- open Gii
- select `FullModel`
- enter model class
- click `preview`
- click `generate`

### Full CRUD

[](#full-crud)

> Note: Generated templates require `clevertech/yiibooster >=1.1.1`Note: slim\_editable require `vitalets/x-editable-yii dev`

- open Gii
- select `FullCrud`
- enter model class
- click `preview`
- click `generate`

#### AuthItems

[](#authitems)

Controller actions and UI buttons follow these `checkAccess` rules:

- Controller.\*
- Controller.View
- Controller.Delete
- ...

From `0.13.0` on the a `Controller.SimpleUi` item was added by default, which hides UI elements, when this item is assigned to the current user.

> Note: An admin (superuser) always sees the full UI.

#### Template slim

[](#template-slim)

Requirements: `https://github.com/clevertech/yiibooster`, `schmunk42/yii-relation`

#### Template slim editable

[](#template-slim-editable)

Requirements:

- `https://github.com/clevertech/yiibooster`,
- `schmunk42/yii-relation`,
- `x-editable-yii`
    - `php composer.phar require vitalets/x-editable-yii dev-master`
    - in config add to aliases `vendor.vitalets.x-editable-yii`

#### Template hybrid

[](#template-hybrid)

An enhanced hybrid between the default/slim templates and the bootstrap crud generator.

Requires `x-editable-yii dev` and `echosen`.

Development
-----------

[](#development)

### Code Providers

[](#code-providers)

The FullCrudCode is able to access providers from a provider-queue to render fields, labels, etc. You can call a provider from your template with, eg.:

```
$this->provider()->generateColumn($this->modelClass, $column)

```

FullCrudCode will walk the provider queue until it finds a provider which has the requested method AND which returns **not `null`**. This is on of the major differences compared to a behavior.

#### Example

[](#example)

Render a populated dropdown, if the model contains and `optsColumnName()` method.

```
public function generateActiveField($model, $column)
{
    $func = "opts".str_replace("_","",$column->name);
    if (method_exists($model, $func)) {
        return "echo \$form->dropDownList(\$model,'{$column->name}',{$model}::{$func}());";
    }
}

```

### Coding Standards

[](#coding-standards)

GTC is using *`` Bobsled Coding Style*.

- Write PHP code to be generated wrapped in short-open-echo tags and **double quotes**

```

```

- Use *bobsled* only for generating PHP code (in the gtc **templates**), DO NOT use short open tags in outputted code (yet)
- Use brackets `{}` to insert variables for generated code
- Use a `provider` to generate fields, labels, relations and columns.
- Follow [guidelines for-good schema design](http://www.yiiframework.com/wiki/227/guidelines-for-good-schema-design/) from the Yii Wiki
- Use a `UNIQUE` index over both of your foreign keys in your `MANY_MANY` tables

#### Examples

[](#examples)

*tbd*

#### Known Problems and Limitations

[](#known-problems-and-limitations)

- gtc does not support composite primary keys

Resources
---------

[](#resources)

### Links

[](#links)

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

History
-------

[](#history)

This project has been originally created by [thyseus](http://www.yiiframework.com/user/1134/) back in 2010.

To quote from the original project page:

> Please enjoy this extension and let us collect as many Templates as possible for other people to enjoy. (haml, smarty, dwoo, twig, ...)

- [Project page up to version 0.6](http://code.google.com/p/gii-template-collection/)

In 2011 [schmunk](https://github.com/schmunk42) create the currently active fork of the project from revision 186 of the Google Code repository.

While there has been much, much, much, … code added over the time. At the end of July 2013 gtc was completely refurbished.

Contributors
------------

[](#contributors)

- Alban Jubert
- Anne Datema
- **Fredrik Wollsén **
- Herbert Maschke  (original creator)
- Igor Santos
- **Tobias Munk **
- Uldis Nelsons
-
- robregonm
- sealtrip
- thyseus

Active maintainers are written in **bold**.

Contact
-------

[](#contact)

Of course, any templates are appreciated and just leave a comment or mail: ,  or .

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 59.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 ~20 days

Recently: every ~76 days

Total

31

Last Release

4386d 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 (355 commits)")[![motin](https://avatars.githubusercontent.com/u/793037?v=4)](https://github.com/motin "motin (127 commits)")[![uldisn](https://avatars.githubusercontent.com/u/3525344?v=4)](https://github.com/uldisn "uldisn (79 commits)")[![thyseus](https://avatars.githubusercontent.com/u/654271?v=4)](https://github.com/thyseus "thyseus (19 commits)")[![Quexer69](https://avatars.githubusercontent.com/u/3859353?v=4)](https://github.com/Quexer69 "Quexer69 (8 commits)")[![ivarsju](https://avatars.githubusercontent.com/u/4513623?v=4)](https://github.com/ivarsju "ivarsju (3 commits)")[![ametad](https://avatars.githubusercontent.com/u/1582541?v=4)](https://github.com/ametad "ametad (2 commits)")[![igorsantos07](https://avatars.githubusercontent.com/u/532299?v=4)](https://github.com/igorsantos07 "igorsantos07 (1 commits)")

---

Tags

dependencypackageautoload

### Embed Badge

![Health badge](/badges/phundament-gii-template-collection/health.svg)

```
[![Health](https://phpackages.com/badges/phundament-gii-template-collection/health.svg)](https://phpackages.com/packages/phundament-gii-template-collection)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k193.1M3.0k](/packages/composer-composer)[league/plates

Plates, the native PHP template system that's fast, easy to use and easy to extend.

1.5k6.1M260](/packages/league-plates)[igaster/laravel-theme

Laravel Themes: Asset &amp; Views folder per theme. Theme inheritance. Blade integration and more...

5151.2M13](/packages/igaster-laravel-theme)[pdmfc/nova-inline-text

A Laravel Nova inline text field.

1049.9k](/packages/pdmfc-nova-inline-text)[atnic/laravel-inspinia

Laravel Package for integrating Inspinia template and this package is Laravel Mix friendly.

164.0k1](/packages/atnic-laravel-inspinia)

PHPackages © 2026

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