CodeIgniter Forums
how to get my own class as library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: how to get my own class as library (/showthread.php?tid=25974)



how to get my own class as library - El Forum - 01-02-2010

[eluser]saidbakr[/eluser]
Hello all,

I have a class published on www.phpclasses.org and its called Fox_captcha. It is meant by creating captcha verification images.

Its package includes two files, Fox_captcha.php - the class file - and another file called fox_captcha_image.php which generates image for reload the image.

My question how could I able to set it as a library working with CI?

Do you think using it as a helper will be better and how?

I think dealing it as an helper will require a third file inwhich I have to write a function that will able to initiate the object and its methods.


how to get my own class as library - El Forum - 01-02-2010

[eluser]2think[/eluser]
Hi Said,

From my understanding of the user guide, helpers are more limited than libraries. Since you're talking about providing captcha image generation which may/may allow for more/different fonts, languages, etc. in the future, I would think a library would be the best fit.

As for incorporating it as a lib, check the user guide where there is a section with that very subject: http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html

Best wishes.