Make your CodeIgniter Sparks!

July 16, 2011 | In: CodeIgniter, getspark, sparks

There’s a vibrant community of modules contributed to be used for CodeIgniter called Sparks.

It’s like PEAR for PHP but specifically for CodeIgniter , if i’m not mistaken it’s like the bakery for cakephp , or rubyforge(gems collection) for Ruby on Rails.

To use, first you will have to get it:

Go to your CI installation path:

$ cd /path/to/your/CI/install/dir

Then, run this command:

php -r "$(curl -fsSL"

It will create two directories, sparks and tools.

sparks – where the modules(spark) will be installed.

tools – the command line tool you will use to get/install those modules.

It will also put two additional files under “CI installation path/application/core”, namely : MY_Loader.php and MY_Router.php

Basically, those two core files will be use to load the 3rd-party spark modules and properly routing them inside of your CI app.

Now , our app get sparked!

For our example spark, we will get a very cool FormBuilder written by Dave Morrow.

$ php tools/spark install -v1.3.0 formbuilder

If you saw ‘formbuilder’ under your sparks directory then you successfully installed it.

Let’s try to use the new spark by loading it via in our controller.

class TestController extends CI_Controller {

   function index()

Fireup your browser to view that, if you didn’t see any error then the new spark library is properly loaded.

1 Response to Make your CodeIgniter Sparks!


Modular Extension with Spark | FROST

September 4th, 2011 at 6:03 pm

[…] time we made our CodeIgniter “sparked” and it went all good. But now when we need to use the Modular Extension, we encounter a bug, but […]

Comment Form