CodeIgniter Forums
How do I include the OOP “defiant randomdotorg” library in codeigniter? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How do I include the OOP “defiant randomdotorg” library in codeigniter? (/showthread.php?tid=70315)



How do I include the OOP “defiant randomdotorg” library in codeigniter? - desbest - 03-23-2018

The class is here (with instructions).
I have it added to 
Code:
application/libraries/randomorg

When I add 
Code:
$this->load->library('RandomOrg\Random');

 to my controller's constructor, I get the following error.

Quote:Message: Class 'RandomOrg\Client' not found
I have tried adding the various files before that (such as Client.php), but that doesn't help.
What is going on and how do I fix it?


RE: How do I include the OOP “defiant randomdotorg” library in codeigniter? - Paradinight - 03-23-2018

(03-23-2018, 09:14 PM)desbest Wrote: The class is here (with instructions).
I have it added to 
Code:
application/libraries/randomorg

When I add 
Code:
$this->load->library('RandomOrg\Random');

 to my controller's constructor, I get the following error.

Quote:Message: Class 'RandomOrg\Client' not found
I have tried adding the various files before that (such as Client.php), but that doesn't help.
What is going on and how do I fix it?

why do you need the randomorg client?

Set $config['composer_autoload'] to true.
Add the composer.json to the application folder.
And install the dependencies


https://www.codeigniter.com/user_guide/general/autoloader.html
https://getcomposer.org/doc/01-basic-usage.md


RE: How do I include the OOP “defiant randomdotorg” library in codeigniter? - desbest - 03-25-2018

I'm not using Composer because I need shell access to install Composer and my web host doesn't provide shell access.
I got the answer on Stack Overflow here https://stackoverflow.com/a/49461228/337306


RE: How do I include the OOP “defiant randomdotorg” library in codeigniter? - Paradinight - 03-25-2018

You do not need composer on you webhost.


RE: How do I include the OOP “defiant randomdotorg” library in codeigniter? - clonescloud - 03-27-2018

Yes, you do not need composer on your web host.