Jens Segers on Feb 19 2012

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!


************ 2 years ago

Wholesale Nike Youth nfl Jerseys For Sale Cheap Wholesale NHL Jerseys Free Shipping

************ 2 years ago

Free fast shipping and best customer service. Shop cheap nfl Jerseys online with us to get big surprise. nfl jerseys Online

DarylKing 6 years ago

Just thought I'd let you know that I have ended up finding a fix for this problem:I changed the rename() function (in line 46 of \tools\lib\spark\spark_utils.php) to the copy() function, which takes the same parameters. It now installs without errors.

DarylKing 6 years ago

I can only guess that its something to do with the Local Server setup as I've tried a completely fresh CI install and had the same result...Is there anything incorrect with the direction of the slashes in the warning? They change direction in the middle...

Jens Segers 6 years ago

I do not have this error. Seems like more of a spark error. Do you have the latest spark cli version?

DarylKing 6 years ago

I would love to be able to run a script to update my sparks, but I keep getting this error when trying to download from the cmd from a Localserver setup on Windows 7...Warning: rename(C:\Users\All\AppData\Local\Temp\/spark-24-1336898497/,./sparks/autoform/3.8.1/ No error in E:\UniServer530_codeigniter\www\tools\lib\spark\spark_utils.php on line 46←[1;36m[ SPARK ]←[0m Spark installed to ./sparks/autoform/3.8.1 - You’re on fire! Would you have any idea whats going on here Jensl ?

Mattparo 6 years ago

Hi JensI appreciate a lot that you have taken your hands on the CI image_library with cropping feature.The last thing I have in mind was to adapt the Jquery cropper from here 1 hour of troubleshooting I cannot get spark installed and after 1 hour of additional manual troubleshootingI get:a. example controller with placeholders where pictures should beb. media controller (same name as in your zip) and corresponding name of media folder does not start and brings the 404do you have any almost idiot proven zip with CI files in it to just copy paste in the Appserv/www root?I don't see the reasons and nobody seems to have the response for that problem in the forums.Appreciate your contribution on github,mattmattxparo@gmail:disqus .complease remove the (x)

Jens Segers 6 years ago

RedBean did indeed use a different connection string. I have added a conversion for the postgre driver:

Andrey Djason Viana 6 years ago

Hi, dont know if it helps anyone (that uses postgre), but I see thats need to set the database configuration to $db['default']['dbdriver'] = 'pgsql'; instead of $db['default']['dbdriver'] = 'postgre'; that is the default/normal config way. At least only with this config I can run my application :-)