Jens Segers on

CodeIgniter sparks

Sparks is a package management system for Codeigniter that will allow you install high-quality libraries into your applications instantly. These sparks are like packages of reusable code that developers make available for download, just like ruby gems.

The sparks system consists of three parts:

  • A central repository at for storing and sharing the sparks
  • A command line utility for managing the sparks and installing them in your CodeIgniter project
  • The sparks themselves

Installing Sparks

To install the Sparks Package Manager, follow the instructions at:

I have converted most of my CodeIgniter projects to sparks and made them available for download at To install any of my sparks in your CodeIgniter project, you can execute a command similar to this one:

php tools/spark install redbean

This will fetch the latest spark version and place it in the /sparks folder.

installing sparks

Loading Sparks

Once you have downloaded the correct spark you can choose to autoload it:

| -------------------------------------------------------------------
|  Auto-load Sparks
| -------------------------------------------------------------------
| Prototype:
|    $autoload['sparks'] = array('example-spark/1.0.0');

$autoload['sparks'] = array('redbean/1.0.2');

Or to manually load it anywhere in your code:


Make sure you always add the correct version number at the end of the spark's name.


Before I started using sparks, I kept running into the situation where a project was using outdated code. Now with the spark tool, I created myself a 'sparkles' script for each project that will automatically load the latest version of all the required sparks:

php tools/spark install friendly-template
php tools/spark install messages
php tools/spark install simple-assets
php tools/spark install secure-auth
php tools/spark install redbean

After executing the script, all I need to do is adjust the version numbers in my autoload.php file and I'm good to go. So easy to keep your code up to date!


Tweet about this blog post and you will appear below!