![]() |
Using a third 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 third party class in CI4 (/showthread.php?tid=82135) |
Using a third party class in CI4 - Sincere - 06-15-2022 I want to use the influxdb-php class in CI4: https://github.com/influxdata/influxdb-php I tried calling the class from the controller using: PHP Code: use InfluxDB; But no success. I installed it using composer: Code: composer require influxdb/influxdb-php RE: Using a third party class in CI4 - iRedds - 06-15-2022 use InfluxDB\Client; new Client(.....); RE: Using a third party class in CI4 - Sincere - 06-16-2022 I'm still getting the following error: Code: Class "InfluxDB\Client" not found When using: PHP Code: use InfluxDB\Client; RE: Using a third party class in CI4 - iRedds - 06-16-2022 CI 4.2.0 installed via composer (updated to 4.2.1) influxdb/influxdb-php - installed via composer. Works. Have you done any manipulations with the structure of the application? RE: Using a third party class in CI4 - Sincere - 06-16-2022 None that I'm aware of. What should I look out for? Where can I look? RE: Using a third party class in CI4 - iRedds - 06-16-2022 By default, the vendor directory (where the composer stores the autoloader and packages) is in the root directory. If you have changed the directory structure, you must ensure that the COMPOSER_PATH constant (app/Config/Constants.php) points to the correct path for the composer autoloader. RE: Using a third party class in CI4 - Sincere - 06-16-2022 It appears to be fine: defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php'); I have myth-auth installed and operational as well through composer. So I don't understand why specifically the InfluxDB client won't load. RE: Using a third party class in CI4 - Sincere - 06-19-2022 "Solved" is by re-creating a new CI4 install, installing the required packages using composer, and copying over the controllers, models, views etc. from the original install. It works now... ![]() |