php - Troubleshooting composer: classes not autoloading with CodeIgniter 3 -
problem
i trying use paypal checkout rest sdk requires paypal library autoloaded through composer. have gone through steps enable composer in codeigniter 3 when go controller autoloading paypal\rest\apicontext
class following error:
fatal error: class 'paypal\rest\apicontext' not found in c:\xampp\htdocs\php\toucan-talk\app\modules\paypal\controllers\paypal.php on line 15
what have far
here composer.json file
{ "require": { "paypal/rest-api-sdk-php" : "*" } }
i have set $config['composer_autoload'] = true;
in config.php file.
here controller
<?php use paypal\rest\apicontext; class paypal extends mx_controller { public function __construct() { $api = new apicontext( ); var_dump($api); } }
question
how troubleshoot composer , autoloader can pinpoint autoload process failing.
well here solution: in config.php instead of setting...
$config['composer_autoload'] = true;
you need put
$config['composer_autoload'] = fcpath . 'vendor/autoload.php';
however still not why works opposed original documentations recommendation. bit of headache really.
Comments
Post a Comment