Introducing Inferno - CodeIgniter + Libraries
For quite some time I’ve been fed up of downloading PHP Classes and having to modify them to turn them into CodeIgniter Libraries.
I’ve also longed to have a version of CodeIgniter that’s pre-filled with lots of really cool and useful libraries. Ready to use on the fly, or autoloaded on every request.
Well, I’d like to introduce ‘Inferno’, the solution to this problem. By wrapping standard, unmodified PHP Classes into libraries, it forms the base of what will soon become a large base of functionality.
It’s a bit difficult to explain without showing you the code… so why not download it and see?
Inferno is pretty basic right now, but it performs a simple job, quite elegantly.
$this->inferno->load('aws'); $this->inferno->aws->load('sqs'); $queues = $this->inferno->aws->sqs->list_queues();
To celebrate the death of PHP4… Inferno is PHP5 only!
Now, I’m ready for suggestions… what libraries should we start packing into this little CI distribution?


















August 19th, 2008 at 3:06 am
Elliot, you sir, are a machine (that’s of course a compliment). That said, I think it would be much more helpful if you only distributed what was added. Not because of any license implications or anything, but simply because if you distribute all of CI, then you’ll need to update each time we update… and that’ll get to be a burden. Plus, there is cool stuff in there already that’s not in the download, and much more cool stuff on the horizon.
Anyhow, just a thought, and great work.
August 19th, 2008 at 3:21 am
I’m speechless. Not only is this an awesome addition to CI, but both of the projects that I spend so much time working on are both bundled!
Tarzan development is moving pretty quickly right now. I’d recommend following @Tarzan_AWS to keep up with the latest changes and updates.
August 19th, 2008 at 4:57 am
Elliot, this is quite impressive. I don’t have anything to suggest, but I do have a serious high five for you!
August 19th, 2008 at 9:34 am
That’s some seriously-awesome-stuff!
I agree with Derek though that you should supply an Inferno-only version without CI. That would make it easier to integrate Inferno into existing projects.
August 19th, 2008 at 10:36 am
This is just plain awesome! A big high five to you Elliott, if this all works out good then you’ve really saved me a huge headache of issues I’ve been having with the Akismet library. Anyhow great work and simply this is just fantastic! Great Work!
August 19th, 2008 at 12:34 pm
Hey guys… thanks for the feedback.
Over the next few days I will be adding more libraries to the default distribution, adding a little user guide, and stripping out the default CI install too.
The main reason for including it was so people could quickly test it.
Elliot
August 19th, 2008 at 2:04 pm
[...] there that don’t follow Elliot Haughins blog, he released an awesome project yesterday called Inferno. The idea here is to create a version of CI that has a bunch of third party code libraries already [...]
August 19th, 2008 at 2:09 pm
Very very nice work Elliot.
I think you could prepare two files, one with CI and one without.
Anyway great job =)
August 19th, 2008 at 7:04 pm
Great work as always! Thanks for making this available, it is going to have a huge impact on the CI community!
August 19th, 2008 at 7:19 pm
This is great, definitely a necessity for any project. Do you have a list of libraries you’re planning on adding? Will you provide any documentation on how to add libraries? It looks like you need to know a little bit about how each library works in order to add the class.
August 20th, 2008 at 2:17 am
this is going to be great, what an awesome initiative!
I think including a lot of the zend libraries may save some time since they’ve done a lot of the class work. i’ve used this method of splicing them in for a while, but it’s so much fluff for not enough payoff i sometimes wonder why I bother when some dont work in CI anyways. http://tinyurl.com/36mnjk
August 20th, 2008 at 10:16 am
[...] от этой проблемы можно с помощью библиотеки Inferno. Ее предназначение – подключение сторонних библиотек [...]
August 20th, 2008 at 2:11 pm
Hi, good work with CI and nice idea with inferno. So my suggestion about a lib is great PHPExcel for generating XLS and PDF files http://www.codeplex.com/PHPExcel
August 21st, 2008 at 9:46 pm
Support for the YouTube API would be great, as well as Flickr.
August 24th, 2008 at 2:50 am
Great work Elliot.
August 27th, 2008 at 1:49 am
Cool idea
One suggestion:
Is it possible for you to give the option of loading the third party libraries into the CI instance instead of the Inferno instance? The setting being in the inferno config?
So, instead of doing:
$this->inferno->load(’simplepie’);
$this->inferno->simplepie->set_feed_url(’http://www.haughin.com/feed/’);
$this->inferno->simplepie->set_cache_location(APPPATH.’cache/rss’);
$this->inferno->simplepie->init();
$this->inferno->simplepie->handle_content_type();
You could do:
$this->inferno->load(’simplepie’);
$this->simplepie->set_feed_url(’http://www.haughin.com/feed/’);
$this->simplepie->set_cache_location(APPPATH.’cache/rss’);
$this->simplepie->init();
$this->simplepie->handle_content_type();
I haven’t tested this yet but the Inferno libraries “load” function would be changed to something along the lines of:
var $CI;
function load($lib, $params = null)
{
// if $config['use_CI'] = TRUE; in inferno’s config
if ($this->use_CI)
{
$this->CI =& get_instance();
}
if ( isset($this->$lib) || ($this->use_CI && isset($this->CI->$lib)))
{
log_message(’debug’, ‘INFERNO :: Load ‘.$lib.’ - Class already loaded!’);
return;
}
include(INFERNO_PATH.’inferno_’.$lib.’.php’);
$class_name = ‘Inferno_’.ucfirst($lib);
if ($this->use_CI)
{
$this->CI->$lib = new $class_name($params);
}
else
{
$this->$lib = new $class_name($params);
}
}
August 27th, 2008 at 2:30 am
Here’s a revised version that tests OK.
In “application/config/inferno.php”:
$config['inferno_instance'] = FALSE; // FALSE to use CI
In “application/libararies/inferno.php”:
function load($lib, $params = null)
{
if ( $this->inferno_instance && isset($this->$lib) || !$this->inferno_instance && isset($this->obj->$lib))
{
log_message(’debug’, ‘INFERNO :: Load ‘.$lib.’ - Class already loaded!’);
return;
}
include(INFERNO_PATH.’inferno_’.$lib.’.php’);
$class_name = ‘Inferno_’.ucfirst($lib);
if ($this->inferno_instance)
{
$this->$lib = new $class_name($params);
}
else
{
$this->obj->$lib = new $class_name($params);
}
}
August 27th, 2008 at 2:45 am
Sorry, Elliot, please delete the “revised” comment above. I missed out on including some code and have made a cleaner, simplified version:
In “application/config/inferno.php” add:
$config['inferno_instance'] = TRUE; // Set to FALSE to use CI instance
In “application/libraries/inferno.php”, replace class with:
class Inferno {
function Inferno($config = array())
{
$this->obj =& get_instance();
define(’INFERNO_PATH’, APPPATH.’libraries/inferno/’);
// Add each config value to the class
foreach($config as $key => $value)
{
$this->$key = $value;
}
$this->_autoload();
}
function _autoload()
{
if ( $this->inferno_autoload )
{
$libs = explode(’,', $this->inferno_autoload);
foreach ( $libs as $lib )
{
$this->load(trim($lib));
}
}
}
function load($lib, $params = null)
{
if ( $this->inferno_instance && isset($this->$lib) || !$this->inferno_instance && isset($this->obj->$lib))
{
log_message(’debug’, ‘INFERNO :: Load ‘.$lib.’ - Class already loaded!’);
return;
}
include(INFERNO_PATH.’inferno_’.$lib.’.php’);
$class_name = ‘Inferno_’.ucfirst($lib);
if ($this->inferno_instance == TRUE)
{
$this->$lib = new $class_name($params);
}
else
{
$this->obj->$lib = new $class_name($params);
}
}
}
August 28th, 2008 at 2:07 pm
I vote for the Sphinx search API
August 29th, 2008 at 10:53 am
Great site. I’m learning to develop web applications as well. How long would you have to have coded in PHP before you dive into Codeigniter framework? How much do I need to know about MySQL before developing a full robust web application?
September 24th, 2008 at 1:24 am
This is awesome. My biggest feature request is documentation.
October 12th, 2008 at 10:45 am
When I try to upload avatar in .JPG i see : Fatal error: Call to undefined function: imagecreatefromjpeg()
and avatar is not saved.
With avatars in .gif everythink is OK.
November 20th, 2008 at 4:05 pm
Elliot, Did you create an install without the CI code base?