CodeIgniter Forums
Class not found error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Class not found error (/showthread.php?tid=80736)



Class not found error - grimpirate - 12-10-2021

Following the procedure for Managing your Applications I installed the starter app then created two directories with their own app/ and public/ subdirectories, respectively, and modified the Config/Paths.php $systemDirectory, $writableDirectory, and $testDirectory in each to reflect the change. However, after
Code:
composer require guzzlehttp/guzzle
and calling
PHP Code:
var_dump(new \GuzzleHttp\Client()); 
on the default Home.php Controller I get a Class "GuzzleHttp\Client" not found error. If on the other hand I leave the app/ and public/ subdirectories and revert Config/Paths.php to its default values the var_dump works just fine (i.e. the guzzle Client object is created successfully). What configuration variable am I neglecting to set in order to locate the appropriate namespace and class?


RE: Class not found error - kenjis - 12-13-2021

You need to fix COMPOSER_PATH.
See https://codeigniter4.github.io/CodeIgniter4/general/managing_apps.html#running-multiple-applications-with-one-codeigniter-installation


RE: Class not found error - SylviaWhite - 01-08-2022

The fix composer path solves it all. Thanks.