PHPackages                             cahyadsn/ci-gen - 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. cahyadsn/ci-gen

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

cahyadsn/ci-gen
===============

Codeigniter-3 Gen is a PHP CLI script that allows you to write controllers, models and views faster

403PHP

Since Jul 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/cahyadsn/ci-gen)[ Packagist](https://packagist.org/packages/cahyadsn/ci-gen)[ RSS](/packages/cahyadsn-ci-gen/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Codeignter Gen CLI
==================

[](#codeignter-gen-cli)

Codeigniter Gen is a PHP CLI script that allows you to write controllers, models and views faster.

Setup
=====

[](#setup)

To verify if you have php cli installed, type into terminal/command prompt.

```
php -v
```

If you receive the php version number, then you are good to go.

Go to your *config.php* file inside the *application/config* and make sure the following line looks like below:

```
$config['uri_protocol'] = 'AUTO';
```

After that line, add:

```
$config['uri_protocol'] = isset($_SERVER['REQUEST_URI']) ? 'PATH_INFO' : 'CLI';
```

Save the file...

Put *Gen.php* (or *gen.php* if you have a lesser than v.3 Codeigniter) inside the controllers directory. Put *config/gen.php* inside your app config folder. Also, put *gen\_templates* folder inside the views folder. From terminal or command prompt go to the application's index.php and type:

```
php index.php gen
```

If everything went well, you should be greeted by Gen.

Usage
=====

[](#usage)

Application
-----------

[](#application)

To create MVC stack (controller, model, view) you can use create:app.

Usage example

```
// Create an MVC stack
php index.php gen create:app users
```

Controllers
-----------

[](#controllers)

### `create:controller name_of_controller`

[](#createcontroller-name_of_controller)

You can use Gen to create a Controller file. The command will need at leas a parameter which represents the name of the controller.

You can put the controller inside a directory. Directories are delimited with ".". So, if you want to create the controller inside controllers/admin, you can do create:controller admin.name\_of\_controller.

Usage examples

```
// Create a Welcome controller that extends MY_Controller
php index.php gen create:controller welcome e:my

// Create a User controller inside admin directory that will extend Admin_Controller
php index.php gen create:controller admin.user extend:admin
```

Models
------

[](#models)

### `create:model name_of_model`

[](#createmodel-name_of_model)

Creates a model having name\_of\_model as name. You can put the model inside a directory. Directories are delimited with ".". So, if you want to create the model inside models/admin, you can do create model admin.name\_of\_model.

Usage examples

```
// Create a user_model model that extends MY_Model
php index.php gen create:model user_model e:my

// Create a User model inside admin directory that will extend MY_Model
php index.php gen create:model admin.user extend:my
```

Views
-----

[](#views)

### `create:view name_of_view`

[](#createview-name_of_view)

Creates a view having name\_of\_view as file name. You can put the view inside a directory. Directories are delimited with ".". So, if you want to create the view inside views/admin, you can do create view admin.name\_of\_view.

Usage examples

```
// Create an index_view.php
php index.php gen create:view user_view

// Create an index_view.php inside users directory
php index.php gen create:view users.index_view
```

Migrations
----------

[](#migrations)

CodeIgniter Gen helps you create, do, undo, and reset migrations.

### `create:migration`

[](#createmigration)

To create a migration you can call create:migration. As a result, a migration will be created in the migrations directory prefixed with version as file name. You can also pass a table name as parameter. If no table name is given, you will have to put the name of the table in the migration file. Below are usage examples:

Usage examples

```
// Create a migration
php index.php gen create:migration create_users_table

// Create a migration with a table inside it
php index.php gen create:migration create_users_table table:users

// Create a migration with a table inside it
php index.php gen create:migration create_users_table t:users

// Create a migration and name the table like the migration
// -> The table name will be 'users' in this exmaple
php index.php gen create:migration t:%inherit% create_users_table
```

### `do:migration`

[](#domigration)

do:migration executes the migrations' up() methods. If you pass the version of the migration a parameter, it will stop at that version of the migration.

Usage examples:

```
// Execute all migrations until the last one
php index.php gen do:migration

// Execute all migrations until a certain version of migration
php index.php gen do:migration 20181210
```

### `undo:migration`

[](#undomigration)

undo:migration returns you to the previous migration version. This one also can accept a migration version as parameter to return to a migration.

Usage examples:

```
// Undo last migration
php index.php gen undo:migration

// Undo the migrations until a specified migration version
php index.php gen undo:migration 20181210
```

### `reset:migration`

[](#resetmigration)

reset:migration will reset the migrations until the migration mentioned in $config\['migration\_version'\] (in the migration configuration file).

Usage example:

```
// Reset the migrations
php index.php gen reset:migration
```

encryption\_key
---------------

[](#encryption_key)

`encryption_key string_to_hash-(OPTIONAL)` - creates an encryption key inside all config.php's found in config folder. If `$config['encryption_key'] = '';` doesn't exist or has a value, the encryption key won't be written.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/97c4e684e79938ab5eb7876934febb0bce36437778ea526188954b2c9ba9d9d8?d=identicon)[cahyadsn](/maintainers/cahyadsn)

---

Top Contributors

[![cahyadsn](https://avatars.githubusercontent.com/u/3700401?v=4)](https://github.com/cahyadsn "cahyadsn (9 commits)")

### Embed Badge

![Health badge](/badges/cahyadsn-ci-gen/health.svg)

```
[![Health](https://phpackages.com/badges/cahyadsn-ci-gen/health.svg)](https://phpackages.com/packages/cahyadsn-ci-gen)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

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