CodeIgniter Forums
Inferno - 3rd Party Classes for CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Inferno - 3rd Party Classes for CodeIgniter (/showthread.php?tid=10928)



Inferno - 3rd Party Classes for CodeIgniter - El Forum - 08-19-2008

[eluser]Elliot Haughin[/eluser]
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.

Read all about it here:
Inferno - CodeIgniter PHP Class Wrapper


Inferno - 3rd Party Classes for CodeIgniter - El Forum - 08-19-2008

[eluser]Sam Dark[/eluser]
Downloaded. Will play with it soon…


Inferno - 3rd Party Classes for CodeIgniter - El Forum - 08-19-2008

[eluser]johnwbaxter[/eluser]
That is quite possibly one of the most useful contributions i've seen so far. Kudos to you!


Inferno - 3rd Party Classes for CodeIgniter - El Forum - 08-19-2008

[eluser]xwero[/eluser]
If i get the idea correct. Instead of changing the class files themselves, a extended inferno class hooks the class to CI with the methods you needed to change in the class files. Making it possible to update the class without changing the files all over again.

Pretty neat!


Inferno - 3rd Party Classes for CodeIgniter - El Forum - 08-19-2008

[eluser]wiredesignz[/eluser]
Very clever, good work Elliot.


Inferno - 3rd Party Classes for CodeIgniter - El Forum - 08-19-2008

[eluser]Elliot Haughin[/eluser]
Yeah, the concept is simple... include the 3rd party class in a wrapper.

The wrapper performs any modifications needed. For example, allowing users to reference camelCasedFunctions with the CI-way of camel_cased_functions.

This way, you can update the 3rd party class straight from a fresh download without having to modify it.

To do this, we need some magic from PHP5... which I've always been reluctant of (since CI is 4+), but with the official death of PHP4, I'm not too bothered about that now.

The only file you should ever need to change is the wrapper.

The idea eventually is to build up a big load of PHP classes which run inside of inferno, and can be downloaded in one sweet package.
Or, you can just use it as a method of wrapping whatever 3rd party classes you'd like to run as CI Libraries.

Any suggestions for great PHP Classes you'd like to see put in the fire?


Inferno - 3rd Party Classes for CodeIgniter - El Forum - 08-20-2008

[eluser]xwero[/eluser]
I'm beginning to wonder why the inferno wrapper library is needed? Why not do
Code:
class Simplepie_ci {
    
        private $CI;        

        function Simplepie_ci()
        {
            include (APPPATH.'libraries/third_party/simplepie/simplepie.inc');

            $this->CI = & get_instance();
            
            $this->CI->simplepie = new Simplepie();
        }
        
        function __call($method, $arguments)
        {            
            return call_user_func_array(array($this->CI->simplepie,    $method), $arguments);
        }
}
And call the wrapper direct
Code:
$this->load->library('simplepie_ci');