Error: Unable to load the requested class - 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: Error: Unable to load the requested class (/showthread.php?tid=73333) |
Error: Unable to load the requested class - Kizaru - 04-12-2019 Greetings, I'm doing a web page project that is about printing shipping labels using PHP and easypost API. However I'm having trouble trying to load the library in the controller. The client php library is on a folder called vendor and it looks like this vendor/ composer easypost/easypost-php/lib Inside the lib folder it looks like this EasyPost (folder) cacert.pem easypost.php I moved the content inside the lib folder to the application library folder So after that I tried to load the library in my Shipping.php controller This is my construct inside shipping controller PHP Code: public function __construct() { However i get an error Unable to load the requested class: EasyPost This is the EasyPost.php code PHP Code: <?php the easypost.php that's not inside the EasyPost folder has this code PHP Code: <?php then everything works fine. But to complete the project I'm required to load the library using codeigniter. So what am I doing wrong? RE: Error: Unable to load the requested class - php_rocs - 04-12-2019 @Kizaru, What version of CI are you using? If you are using CI 3.x the library loader is expecting a class not a namespace. Check the forums for solutions that will allow you to use namespaces. |