Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Kohana module for generating application and module resources

Generator for Kohana

This module, inspired by the Ruby on Rails tool of the same name, allows the automatic creation of application and module resources from templates using different configurable generators. It includes a versatile Builder class with a fluent interface for combining different generator types, and a set of Minion tasks for running generators from the command line.

Generator Builder

The Builder's fluent interface allows easy creation of different resource types. At its simplest, to create a Log class in APPPATH/classes/Log.php:


Different resources can also be created in one command by combining generator types:


In this example, a class is created with a stub for transparent extension in the 'logger' module directory, along with a skeleton unit test case for it. Global options can also be set on all the types added to the builder (in this case, the module name via with_module()).

See the Guide pages for more information on different types and examples of using the Builder in more complex cases. There are also plenty of examples in the Generator tasks.

Minion Tasks

The module includes a set of Minion tasks for running generators from the commmandline. Start here for help and common options:

./minion generate --help

And then enjoy creating your application or module resources in one line:

./minion generate:class --name=Logger_Log --stub=Log --module=logger

See also the Guide pages for more information about different generator tasks and their options.

Current tasks include: class, controller, model, view, unittest, task, generator, interface, guide, module, config, message, trait (PHP >= 5.4.0), etc.


This module is unit tested using the Unittest module. You can use the generator group to run only the generator tests. See also the files in the tests/fixtures directory for sample Minion commands and their generated output.


The module was built against Kohana version 3.3, and requires Minion for running the tasks. Optional support for traits requires PHP >= 5.4.0.

Something went wrong with that request. Please try again.