![]() |
trying to use Composer - 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: trying to use Composer (/showthread.php?tid=71359) |
trying to use Composer - richb201 - 08-04-2018 I am trying to load up the AWS PHP sdk. The install instructs say to use composer, which I did. It then states: Require the Composer autoloader in your scripts. Code: <?php what is /path/to/vendor/ mean? what vendor? Are they talking about the vendor directory in my CI project? I see an autoload.php in my vendor directory in my CI project. But how do I path to this? from the root of the project which would be /xxx/vendor/autoload.php. I don't know what xxx would be? My prject is call sub_crud so would it be /sub_crud/vendor/autoload.php ? I copied /aws/s3 into third_party/ <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require 'vendor/autoload.php'; use third_party\Aws\S3\S3Client; But looking in the S3 directory, I see all the files are .java. Does that mean I have the wrong version of the sdk? Should they be .php? But when I start up the AWS\S3\S3Client can't be found. RE: trying to use Composer - richb201 - 08-05-2018 I have given up trying to use Composer. I have tried it before and it has NEVER worked for me. I am going to close this topic. RE: trying to use Composer - ciadmin - 08-05-2018 Did you change the configuration setting? https://codeigniter.com/user_guide/general/autoloader.html?highlight=composer RE: trying to use Composer - richb201 - 08-05-2018 Thanks. I did that now. I am still getting error below. I removed the third_party\vendor\aws\s3 directory but with little effect. I also set $config['composer_autoload'] = TRUE; in config.php ( ! ) Fatal error: Class 'S3Client' not found in C:\xampp\htdocs\sub_crud\application\controllers\Configure.php on line 1145 Call Stack # Time Memory Function Location 1 0.2160 152800 {main}( ) ...\index.php:0 2 0.2500 199312 require_once( 'C:\xampp\htdocs\sub_crud\system\core\CodeIgniter.php' ) ...\index.php:316 3 0.2820 1175432 Configure->__construct( ) ...\CodeIgniter.php:518 4 0.3280 3588080 Configure->_init( ) ...\Configure.php:21 5 0.3290 3589096 Configure->test( ) ...\Configure.php:38 A PHP Error was encountered Severity: Error Message: Class 'S3Client' not found Filename: controllers/Configure.php Line Number: 1145 Here is the code I am trying to run: Code: public function test(){ The following items can be loaded automatically:
RE: trying to use Composer - InsiteFX - 08-06-2018 Check your vendor directory, that's where it usually places them. RE: trying to use Composer - richb201 - 08-06-2018 I tried putting this at the top of my controller: require 'Application/third_party/aws/aws-autoloader.php'; But I am still getting: A PHP Error was encountered Severity: Error Message: Class 'S3Client' not found Filename: controllers/Configure.php Line Number: 1157 So I reinstalled with Composer. Now I put this line at the top of my controller: require 'vendor/autoload.php'; But I still get Message: Class 'S3Client' not found! RE: trying to use Composer - richb201 - 08-07-2018 I refuse to give up. I am stepping through the loadClass function in ClassLoader.php. This line is reached: if ($file = $this->findFile($class)) //$class = "Aws\s3\S3Client" this file is not being found. I do see a file called S3Client.php in the third_party/aws/AWS/S3/S3Client.php Two questions 1) does the code know to look in /third_party? 2) do you think that the two aws's is screwing it up 3) what's up with the missing .php? RE: trying to use Composer - InsiteFX - 08-07-2018 looks like you have two aws directories. $class is only showing one aws directory. RE: trying to use Composer - richb201 - 08-07-2018 That's not it. I tried moving everything from Aws/aws to just aws. $file = $this->findFile($class)) << this is failing when $class is "Aws\S3\S3Client" Tracing through i see that the s3Client is not being found in the $this->classmap. The reason is that it is looking for things in C:\xampp\htdocs\sub_crud\vendor\composer/../ But I am not using composer! I have set $config['composer_autoload'] = FALSE; What do I do? I am willing to try to install with Composer one more time. But there seems no way to uninstall Composer. When I install from Composer, do I need to be in the sub_crud/Vendor/ directory first? RE: trying to use Composer - richb201 - 08-07-2018 I got it working (or at least not crashing). All I did was reinstall Composer. |