![]() |
Using a thrid party Class in 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: Using a thrid party Class in CI4 (/showthread.php?tid=76344) |
Using a thrid party Class in CI4 - niklas - 05-05-2020 Hello toghether, i want to use a third party class in my project to generate qr codes. There is an old libary "qrlib" which is not namespaced but it works :-) So I added the class "QRcode" to the $classmap Array in the app/config/autoload.php PHP Code: $classmap = [ My question now.. how can i use it? If I use it in a Controller like PHP Code: QRcode::png('blablabla') I get the error "QRcode" could not be found. I thought it is autoloaded? Also I tried to load it manually $this->load() but this function does not longer exists in CI4 ![]() I think this is a simpe question because its about how to use the autoload of CI4 but I dind't found any information in the manual. Best regards, Niklas RE: Using a thrid party Class in CI4 - jreklund - 05-05-2020 Hi, you need to use \QRcode\QRcode::png('blablabla'), as you put that folder under that namespace. If I remember it correctly. Or it's just \QRcode::png('blablabla'). RE: Using a thrid party Class in CI4 - niklas - 05-11-2020 (05-05-2020, 11:29 AM)jreklund Wrote: Hi, you need to use \QRcode\QRcode::png('blablabla'), as you put that folder under that namespace. If I remember it correctly. Or it's just \QRcode::png('blablabla'). it is not working ![]() I think you are right but the libary i want to use is not compatible. There are many classes in different Files where filename and classname doesn't match. Everything is just thrown together by a file with many "includes". So maybe I take the time and write a corrent QR Code Libary or I will search for another one out there... It can't be such a big deal to create qr codes -.- |