Skip to content
Cli for CodeIgniter 3.0
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Add sample code Jun 27, 2015
tests Small fixes and add tests May 21, 2015
.coveralls.yml Fix coveralls.yml May 2, 2015
.gitignore Fix phpunit.xml.dist Apr 29, 2015
.scrutinizer.yml Add Coveralls May 2, 2015
ci_instance.php Fix coding style Apr 29, 2015
composer.json Fix composer.json and composer update Jun 29, 2015
phpunit.xml.dist Add and refactor tests Apr 30, 2015

Cli for CodeIgniter 3.0

Latest Stable Version Total Downloads Latest Unstable Version License

Scrutinizer Code Quality Coverage Status Build Status

This package provides a Cli tool for CodeIgniter 3.0.

This includes a few commands and you can create your commands easily.

This is based on Aura.Cli_Project 2.0.

Included Commands

generate migration ... Generates migration file skeleton.
migrate            ... Run migrations.
migrate status     ... List all migration files and versions.
seed               ... Seed the database.
run                ... Run controller.

Folder Structure

├── application/
├── ci_instance.php ... script to generate CodeIgniter instance
├── cli             ... command file
├── config/         ... config folder
└── vendor/


  • PHP 5.4.0 or later
  • composer command
  • Git


Install this project with Composer:

$ cd /path/to/codeigniter/
$ composer require kenjis/codeigniter-cli --dev

Install command file (cli) and config files (config/) to your CodeIgniter project:

$ php vendor/kenjis/codeigniter-cli/install.php
  • Above command always overwrites exisiting files.
  • You must run it at CodeIgniter project root folder.

Fix the paths in ci_instance.php if you need.

$system_path        = 'vendor/codeigniter/framework/system';
$application_folder = 'application';
$doc_root           = 'public'; // where index.php is

If you install CodeIgniter using codeigniter-composer-installer, you don't have to change them.


Show command list.

$ cd /path/to/codeigniter/
$ php cli

Show help for a command.

$ php cli help seed

Create Database Seeds

Seeder class must be placed in application/database/seeds folder.



class ProductSeeder extends Seeder {

	public function run()

		$data = [
			'category_id' => 1,
			'name' => 'CodeIgniter Book',
			'detail' => 'Very good CodeIgniter book.',
			'price' => 3800,
		$this->db->insert('product', $data);

		$data = [
			'category_id' => 2,
			'name' => 'CodeIgniter CD',
			'detail' => 'Great CodeIgniter CD.',
			'price' => 4800,
		$this->db->insert('product', $data);

		$data = [
			'category_id' => 3,
			'name' => 'CodeIgniter DVD',
			'detail' => 'Awesome CodeIgniter DVD.',
			'price' => 5800,
		$this->db->insert('product', $data);


Create User Command

Command class name must be *Command.php and be placed in application/commands folder.



class TestCommand extends Command {

	public function __invoke()
		$this->stdio->outln('<<green>>This is TestCommand class<<reset>>');


Command Help class name must be *CommandHelp.php and be placed in application/commands folder.



class TestCommandHelp extends Help {

	public function init()
		$this->setSummary('A single-line summary.');
		$this->setUsage('<arg1> <arg2>');
			'f,foo' => "The -f/--foo option description",
			'bar::' => "The --bar option description",
		$this->setDescr("A multi-line description of the command.");



How to Run Tests

To run tests, you must install CodeIgniter first.

$ composer create-project kenjis/codeigniter-composer-installer codeigniter
$ cd codeigniter
$ composer require kenjis/codeigniter-cli:1.0.x@dev --dev
$ php vendor/kenjis/codeigniter-cli/install.php
$ cd vendor/kenjis/codeigniter-cli
$ composer install
$ phpunit

Related Projects for CodeIgniter 3.0

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.