PHPackages                             rougin/spark-plug - 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/spark-plug

ActiveLibrary[Framework](/categories/framework)

rougin/spark-plug
=================

Codeigniter 3 projects as variables.

v0.6.3(1y ago)1618.2k↑478.3%54MITPHPPHP &gt;=5.3.0CI passing

Since Jun 25Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/rougin/spark-plug)[ Packagist](https://packagist.org/packages/rougin/spark-plug)[ Docs](https://roug.in/spark-plug/)[ RSS](/packages/rougin-spark-plug/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (16)Used By (4)

Spark Plug
==========

[](#spark-plug)

[![Latest Version on Packagist](https://camo.githubusercontent.com/daf6d1a74d0781937c838ad864a26fa39297d15c5439c2a97974958f07e338be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f7567696e2f737061726b2d706c75672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rougin/spark-plug)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/rougin/spark-plug/blob/master/LICENSE.md)[![Build Status](https://camo.githubusercontent.com/e04941556e9fb596d5042f93463f7787428820b23bf8f8481b0196843d557e53/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f7567696e2f737061726b2d706c75672f6275696c642e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/rougin/spark-plug/actions)[![Coverage Status](https://camo.githubusercontent.com/a5de92e98eb065044e38a14f5c8e7528bbdfc404dc476e23bd7044cd34de942b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f726f7567696e2f737061726b2d706c75673f7374796c653d666c61742d737175617265)](https://app.codecov.io/gh/rougin/spark-plug)[![Total Downloads](https://camo.githubusercontent.com/3c124d8b147128526a4842c9012ca67f89a5aff9fca9863142ccfdc58409238a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f7567696e2f737061726b2d706c75672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rougin/spark-plug)

A special package that returns an application based on [Codeigniter 3](https://codeigniter.com/) as a single variable. Might be useful when testing a `Codeigniter 3` project to frameworks such as [PHPUnit](https://phpunit.de/).

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

[](#installation)

Install `Spark Plug` through [Composer](https://getcomposer.org/):

```
$ composer require rougin/spark-plug
```

Basic Usage
-----------

[](#basic-usage)

### Using the `Instance` helper

[](#using-the-instance-helper)

```
$ci = Rougin\SparkPlug\Instance::create();

// You can now use the CI_Controller instance
$ci->load->helper('inflector');
```

Note

Instead of `CI_Controller`, it returns `Rougin\SparkPlug\Controller` for type-hinting its helpers and libraries.

### Using the `SparkPlug` class

[](#using-the-sparkplug-class)

```
use Rougin\SparkPlug\SparkPlug;

$sparkplug = new SparkPlug($GLOBALS, $_SERVER);

$ci = $sparkplug->instance();

// The Inflector helper is now loaded ---
$ci->load->helper('inflector');
// --------------------------------------
```

### Modify constants to be defined

[](#modify-constants-to-be-defined)

```
use Rougin\SparkPlug\SparkPlug;

$sparkplug = new SparkPlug($GLOBALS, $_SERVER);

// Set the value of the APPPATH constant ---
$sparkplug->set('APPPATH', '/path/to/app');
// -----------------------------------------

$ci = $sparkplug->instance();
```

Available constants that can be modified:

- `APPPATH`
- `VENDOR`
- `VIEWPATH`

Note

If setting a new `APPPATH` value, the value of `VIEWPATH` will be set to `APPPATH/views`.

### Mock `CI_Controller` for unit testing

[](#mock-ci_controller-for-unit-testing)

```
use Rougin\SparkPlug\Instance;

class SampleTest extends \PHPUnit_Framework_TestCase
{
    public function testCodeigniterInstance()
    {
        // Directory path to the test application
        $application = __DIR__ . '/TestApp';

        // Instance::create($path, $_SERVER, $GLOBALS)
        $ci = Instance::create($application);

        $this->assertInstanceOf('CI_Controller', $ci);
    }
}
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/rougin/spark-plug/blob/master/CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Credits
-------

[](#credits)

- [All contributors](https://github.com/rougin/spark-plug/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](https://github.com/rougin/spark-plug/blob/master/LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance67

Regular maintenance activity

Popularity33

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.5% 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 ~243 days

Recently: every ~722 days

Total

15

Last Release

620d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.0

v0.6.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7721589a958a1fbcef1b527c794d820d75b82988f14b2ed86a1c6904d76a59e?d=identicon)[rougin](/maintainers/rougin)

---

Top Contributors

[![rougin](https://avatars.githubusercontent.com/u/6078637?v=4)](https://github.com/rougin "rougin (64 commits)")[![Jehong-Ahn](https://avatars.githubusercontent.com/u/590801?v=4)](https://github.com/Jehong-Ahn "Jehong-Ahn (1 commits)")

---

Tags

codeigniter-librarycore-libraryphp-libraryspark-plugphpcodeigniterspark-plug

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rougin-spark-plug/health.svg)

```
[![Health](https://phpackages.com/badges/rougin-spark-plug/health.svg)](https://phpackages.com/packages/rougin-spark-plug)
```

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

681.0M18](/packages/pestphp-pest-plugin-stressless)[phpmv/php-mv-ui

A JQuery and UI library for php and php MVC frameworks

3520.5k3](/packages/phpmv-php-mv-ui)[alleyinteractive/pest-plugin-wordpress

WordPress Pest Integration

274.0k1](/packages/alleyinteractive-pest-plugin-wordpress)

PHPackages © 2026

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