PHPackages                             rougin/combustor - 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. [Framework](/categories/framework)
4. /
5. rougin/combustor

ActiveLibrary[Framework](/categories/framework)

rougin/combustor
================

MVC code generator for Codeigniter 3.

v1.3.1(3w ago)314.2k15MITPHPPHP &gt;=5.4.0CI passing

Since Apr 1Pushed 3w ago5 watchersCompare

[ Source](https://github.com/rougin/combustor)[ Packagist](https://packagist.org/packages/rougin/combustor)[ Docs](https://roug.in/combustor/)[ RSS](/packages/rougin-combustor/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (14)Versions (15)Used By (0)

Combustor
=========

[](#combustor)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ce73bfb3f1cac49032b65959e33a8d4484f252c531afdff39f2fa976b72ef584/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f7567696e2f636f6d627573746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rougin/combustor)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/rougin/combustor/blob/master/LICENSE.md)[![Build Status](https://camo.githubusercontent.com/3531e3645e17182f3c7fe9bfd85aafc56f6fc3efafc6fa3f5a6da64cd3717300/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f7567696e2f636f6d627573746f722f6275696c642e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/rougin/combustor/actions)[![Coverage Status](https://camo.githubusercontent.com/7f915bc5eb5f49da215d2d396c49b8ba7d527d207bb29bc0ce0777e4019b4ca0/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f726f7567696e2f636f6d627573746f723f7374796c653d666c61742d737175617265)](https://app.codecov.io/gh/rougin/combustor)[![Total Downloads](https://camo.githubusercontent.com/f571cd0e56ca8374359d3ea2d727334bcb5cb83b71b219496d0c9ed1937edb67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f7567696e2f636f6d627573746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rougin/combustor)

Combustor is a utility package for [Codeigniter 3](https://codeigniter.com/userguide3/) that generates controllers, models, and views based on the provided database tables. It uses the [Describe](https://roug.in/describe/) package for getting columns from a database table and as the basis for code generation.

Features
--------

[](#features)

- Generates code based on the structure of the `Codeigniter 3` framework;
- Speeds up the code development for prototyping web applications;
- View templates can be based on Bootstrap and are upgradable; and
- Only worry on the database schema, and `Combustor` will do the rest.

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

[](#installation)

Extract the contents of the [latest Codeigniter 3 project](https://github.com/bcit-ci/CodeIgniter/archive/3.1.13.zip) first:

```
$ wget https://github.com/bcit-ci/CodeIgniter/archive/3.1.13.zip
$ unzip 3.1.13.zip -d ciacme
```

Then configure the project's database connectivity settings:

```
$ cd ciacme
$ nano application/config/database.php

```

```
// ciacme/application/config/database.php

// ...

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost',
    'username' => '',
    'password' => '',
    'database' => '',
    'dbdriver' => 'mysqli',

    // ...
);
```

Next is to proceed in installing `Combustor` via [Composer](https://getcomposer.org/):

```
$ composer require rougin/combustor --dev
```

```
// ciacme/composer.json

{
  // ...

  "require-dev":
  {
    "mikey179/vfsstream": "1.6.*",
    "phpunit/phpunit": "4.* || 5.* || 9.*",
    "rougin/combustor": "~1.0"
  }
}
```

Lastly, install the ORM wrappers like `Wildfire` or `Doctrine`:

```
$ vendor/bin/combustor install:wildfire
$ vendor/bin/combustor install:doctrine
```

Note

Using the `install:wildfire` command installs the [Wildfire](https://roug.in/wildfire/) package while the `install:doctrine` installs the [Credo](https://roug.in/credo/) package.

Reminders
---------

[](#reminders)

Prior in executing any commands, kindly ensure that the ***database tables are defined properly*** (foreign keys, indexes, relationships, normalizations) in order to minimize the modifications after the code structure has been generated.

Also, please proceed first in generating models, views, or controllers to database tables that are having ***no relationship with other tables*** in the database.

Tip

`Combustor` will generate controllers, models, or views based on the specified database schema. If there's something wrong in the specified database schema, `Combustor` will generate a bad codebase.

Commands
--------

[](#commands)

### `create:layout`

[](#createlayout)

Create a new header and footer file.

**Options**

- `--bootstrap` - adds styling based on Bootstrap
- `--force` - generates file/s even they already exists

**Example**

```
$ vendor/bin/combustor create-layout --bootstrap
```

### `create:controller`

[](#createcontroller)

Create a new HTTP controller.

**Arguments**

- `table` - name of the database table

**Options**

- `--doctrine` - generates a Doctrine-based controller
- `--wildfire` - generates a Wildfire-based controller
- `--empty` - generates an empty HTTP controller
- `--force` - generates file/s even they already exists

Note

If either `Wildfire` or `Doctrine` is installed, no need to specify it as option for executing a specified command (e.g. `--wildfire`). However if both are installed, a command must have a `--wildfire` or `--doctrine` option added.

**Example**

```
$ vendor/bin/combustor create:controller users --wildfire
```

### `create:model`

[](#createmodel)

Create a new model.

**Arguments**

- `table` - name of the database table

**Options**

- `--doctrine` - generates a Doctrine-based model
- `--wildfire` - generates a Wildfire-based model
- `--empty` - generates an empty model
- `--force` - generates file/s even they already exists

**Example**

```
$ vendor/bin/combustor create:model users --wildfire
```

### `create:repository`

[](#createrepository)

Create a new entity repository.

**Arguments**

- `table` - name of the database table

**Options**

- `--force` - generates file/s even they already exists

**Example**

```
$ vendor/bin/combustor create:repository users
```

Note

This command is only applicable to a [Doctrine](https://roug.in/credo) implementation.

### `create:view`

[](#createview)

Create view templates.

**Arguments**

- `table` - name of the database table

**Options**

- `--bootstrap` - adds styling based on Bootstrap
- `--doctrine` - generates Doctrine-based views
- `--wildfire` - generates Wildfire-based views
- `--force` - generates file/s even they already exists

**Example**

```
$ vendor/bin/combustor create:view users --bootstrap
```

### `create:scaffold`

[](#createscaffold)

Create a new HTTP controller, model, and view templates.

**Arguments**

- `table` - name of the database table

**Options**

- `--bootstrap` - adds styling based on Bootstrap
- `--doctrine` - generates a Doctrine-based controller, model, and views
- `--wildfire` - generates a Wildfire-based controller, model, and views
- `--force` - generates file/s even they already exists

**Example**

```
$ vendor/bin/combustor create:scaffold users --bootstrap --wildfire
```

Note

If `--doctrine` is selected, the command will also execute the `create:repository` command.

### `install:doctrine`

[](#installdoctrine)

Install the [Doctrine](https://roug.in/credo/) package.

**Example**

```
$ vendor/bin/combustor install:doctrine
```

Note

- This command will be available if `Doctrine` is not installed in the project.
- It also adds a `Loader.php` in the `core` directory. The said file is used for loading custom repositories extended to `EntityRepository`.

### `install:wildfire`

[](#installwildfire)

Install the [Wildfire](https://roug.in/wildfire/) package.

**Example**

```
$ vendor/bin/combustor install:wildfire
```

Note

This command will be available if `Wildfire` is not installed in the project.

### `remove:doctrine`

[](#removedoctrine)

Remove the [Doctrine](https://roug.in/credo/) package.

**Example**

```
$ vendor/bin/combustor remove:doctrine
```

Note

This command will be available if `Doctrine` is installed in the project.

### `remove:wildfire`

[](#removewildfire)

Remove the [Wildfire](https://roug.in/wildfire/) package.

**Example**

```
$ vendor/bin/combustor remove:wildfire
```

Note

This command will be available if `Wildfire` is installed in the project.

Using `combustor.yml`
---------------------

[](#using-combustoryml)

`Combustor` currently works out of the box after the configuration based on `Installation`. However, using a `combustor.yml` can be used for complex setups like specifying the new application path and excluding columns:

```
# combustor.yml

app_path: %%CURRENT_DIRECTORY%%/Sample

excluded_fields:
  - created_at
  - updated_at
  - deleted_at
```

To create a `combustor.yml`, simply run the `initialize` command:

```
$ vendor/bin/combustor initialize
[PASS] "combustor.yml" added successfully!
```

### `app_path`

[](#app_path)

This property specifies the `application` directory. It may updated to any directory (e.g., `ciacme/application`, `ciacme/config`, etc.) as long it can detect the `config/config.php` file from the defined directory:

```
# combustor.yml

app_path: %%CURRENT_DIRECTORY%%/Sample

# ...
```

Note

`Combustor` will try to check the path specified in `app_path` if it is a valid `Codeigniter 3` project. Then it will perform another check if the `application` directory exists or if the `config` directory can be accessed directly from the directory defined in `app_path`.

### `excluded_fields`

[](#excluded_fields)

Specified fields in this property are excluded from generation to the following templates:

- `controllers`
- `models`
- `views` (only for `create` and `edit` templates)

```
# combustor.yml

# ...

excluded_fields:
  - created_at
  - updated_at
  - deleted_at
```

Note

The timestamps are added by default when creating a `combustor.yml` for the first time as they are usually populated automatically by installed ORMs such as `Wildfire` or `Doctrine`.

### `custom_fields`

[](#custom_fields)

By default, all of the fields generated by `Combustor` to `create` and `edit` pages will use the `form_input` helper:

```
