Elliot Haughin

Weblife

Thoughts

  • About to pay for moblie me. Absolutely love the service so far. Will be well worth it!
  • Time for bed. I'll forget I've changed my hair and get a shock when I look in the mirror tomorrow!
  • Hair finished, and it's very very black!
  • Dying my hair. First time I've done by own. Hope it comes out ok. I'll see in 30 minutes!
  • Down the pub with the church crew. It's strange discussing the preach over a cold pint!
  • Anyone going to the 5pm service at hillsong London? It's gonna be great!
  • The perfect night. Lots to drink, house party with friends, no hangover and a fried breakfast. Brilliant!
  • Phoned dell about my fried graphics card in my xps. This warranty is great! Engineer coming to my work to replace the card on Tuesday!

Tunes

  • 16 hours agoSwitchfoot – Meant to Live
  • 16 hours agoJet – Hold On
  • 16 hours agoTrain – Ordinary
  • 16 hours agoDashboard Confessional – Vindicated
  • 18 hours agoMe First and the Gimme Gimmes – She Believes In Me (Kenny Rogers)
  • 18 hours agoMe First and the Gimme Gimmes – On The Road Again (Willie Nelson)
  • 18 hours agoMe First and the Gimme Gimmes – Goodbye Earl (Dixie Chicks)
  • 18 hours agoMe First and the Gimme Gimmes – San Francisco
  • 18 hours agoMe First and the Gimme Gimmes – My Boyfriend's Back
  • 18 hours agoMe First and the Gimme Gimmes – Blowin' in the Wind

Introducing Inferno - CodeIgniter + Libraries

Posted by Elliot on Monday, August 18th, 2008

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?

Posted in: featured.

23 Responses to “Introducing Inferno - CodeIgniter + Libraries”

  1. Derek Allard Says:

    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.

  2. Ryan Parman Says:

    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.

  3. Chad Crowell Says:

    Elliot, this is quite impressive. I don’t have anything to suggest, but I do have a serious high five for you!

  4. Jakob Buis Says:

    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.

  5. Cody P. Christian Says:

    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!

  6. Elliot Says:

    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

  7. CI Inferno | Chris Monnat Says:

    [...] 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 [...]

  8. Lorenzo Meriggi Says:

    Very very nice work Elliot.

    I think you could prepare two files, one with CI and one without.

    Anyway great job =)

  9. Andreas Krohn Says:

    Great work as always! Thanks for making this available, it is going to have a huge impact on the CI community!

  10. Adam Jackett Says:

    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.

  11. Jim Carter Says:

    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

  12. Inferno: подключаем сторонние библиотеки к CodeIgniter Says:

    [...] от этой проблемы можно с помощью библиотеки Inferno. Ее предназначение – подключение сторонних библиотек [...]

  13. Blazej Lyjak Says:

    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

  14. Pål Degerstrøm Says:

    Support for the YouTube API would be great, as well as Flickr.

  15. Leonidas Tsementzis Says:

    Great work Elliot.

  16. stensi Says:

    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);
    }
    }

  17. stensi Says:

    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);
    }
    }

  18. stensi Says:

    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);
    }
    }
    }

  19. Tillman Mosley III Says:

    I vote for the Sphinx search API

  20. Jay Says:

    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?

  21. Dayton Says:

    This is awesome. My biggest feature request is documentation.

  22. Ecoclorjoully Says:

    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.

  23. Mark Says:

    Elliot, Did you create an install without the CI code base?

Leave a Reply

Outside ChurchOutside ChurchOutside ChurchOutside ChurchOutside ChurchOutside ChurchOutside ChurchHouse PartyHouse PartyHouse PartyHouse PartyHouse PartyHouse PartyHouse PartyHouse PartyHouse PartyHouse PartyHouse Party