CodeIgniter Forums
Help with adding external php lib to ci4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Help with adding external php lib to ci4 (/showthread.php?tid=76147)



Help with adding external php lib to ci4 - lonyprogman - 04-16-2020

Hey there,

I have a problem to load php library in CodeIgniter 4
I actually use this captcha library: https://www.phpcaptcha.org/

And now my problem is, i don't know how to process to load my library,
i have the first php file(securimage.php) to check the captcha code like this:
PHP Code:
if (!$securimage->check($captcha)) {
            return $isGood false;


and the second (securimage_show.php) to show the captcha and other file for the running of captcha like this:
PHP Code:
<img src="captcha" alt="CAPTCHA Image"/><br>
<
a href="#" onclick="document.getElementById('captcha').src = 'captcha?' + Math.random(); return false">[ Different Image ]</a

Now to make it work i need to assign the object (Securimage provide by the securimage.php file) to a variable
PHP Code:
$captcha= new Securimage(); 


I hope i write my problem as clean as possible Smile

Thanks,
Lony.


RE: Help with adding external php lib to ci4 - captain-sensible - 04-18-2020

i have had a quick look , i think one problem is that if you look inside secureimage.php it is not conforming to use of namespace.

i've done my own simple captacha , if you click go to website below my post then add url /blackcat

you will see a very simple generation of numbers. I can help with that otherwise maybe a new thread captach options, ease of use etc