Using CodeIgniter Sparks

Not too long ago, if you wanted to install an extension or some external software for CodeIgniter, you had to hunt it down. You'd need to search for what you were looking for on the Internet and if you were lucky, you would find a blog or someone's personal site, perhaps even a GitHub account or Google code repository where you could download and install a package. Sometimes it worked, sometimes it didn't and whatever you downloaded it almost always needed some level of editing or re-writing.

Fast forward to, now! Thankfully, we have Sparks. Think of Sparks as extensions you can use with CodeIgniter. They're kept in one place (so you don't have to hunt them down across the Internet) at http://www.getsparks.org.

We touched on Sparks in Chapter 1, CodeIgniter Basics, however, let's go into more detail and get you to install and use a couple of Sparks which I have found useful over time.

So, if you haven't installed it until now, install Sparks in your CodeIgniter instance. Either go to Chapter 1, CodeIgniter Basics, for instructions on how to do this, or follow the instructions on the GetSparks website.

Getting ready

First, you need to navigate to the top level (or root) of your CodeIgniter directory.

How to do it...

If you are using MAC or Linux, download CodeIgniter Sparks as follows:

  1. On the command line, navigate to the root of your CodeIgniter application, and type:
    php -r "$(curl -fsSL http://getsparks.org/go-sparks)"

    This will download and install CodeIgniter Sparks to your specific CodeIgniter instance.

If you are using Windows, then you will need to download Sparks and unpack manually. To do follow these instructions or check out the instructions on the GetSparks website for the latest version:

  1. Create a folder named tools in the top level (root) of your CodeIgniter directory.
  2. Go to the following URL: http://getsparks.org/install.
  3. Go to the Normal Installation section and download the Sparks package.
  4. Unpack the download into the tools folder you created in step 1.
  5. Download the Loader class extension from: http://getsparks.org/static/install/MY_Loader.php.txt.
  6. Rename the MY_Loader.php.txt file, to MY_Loader.php, and move it to the application/core/MY_Loader.php directory in your CodeIgniter application.

How it works...

Sparks is downloaded to the /path/to/codeigniter/tools folder of your CodeIgniter instance ready for use. You can install any Spark you wish by issuing the following command:

php tools/spark install [version] spark-name

Here, [version] is the specific version of the Spark. It is optional, and if you omit it, Sparks will automatically select the latest version. spark-name is the name of the Spark you wish to download.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.97.219