CodeIgniter Forums
How to use Composer installed libs? - 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: How to use Composer installed libs? (/showthread.php?tid=80682)



How to use Composer installed libs? - simoon - 12-01-2021

Hi,

i installed jlevers/selling-partner-api with composer.

Code:
require_once __DIR__ . '/vendor/autoload.php';

use SellingPartnerApi\Api;
use SellingPartnerApi\Configuration;
use SellingPartnerApi\Endpoint;

Does not work. Can someone tell me how to get it running?
Best regards,
Alex


RE: How to use Composer installed libs? - captain-sensible - 12-01-2021

if you installed your codeigniter web with composer, then you should have a composer.json file at your web root and that if from the context of being at your web route from a shell window and you used :
Code:
composer require jlevers/selling-partner-api


then 2 things should have happened, you should have seen that your composer.json file has been updated snd now contains and entry for jlevers . Also that if you look
in your vendor directory you will also see a directory called something like jlevers.

In the process autoload would have been updated so in a controller , you don't need that line:

Code:
require_once __DIR__ . '/vendor/autoload.php';


normally with a class it would be instantiation

$handle = new Class ();

looking breifly at it, it says you need account and docs are :

https://github.com/jlevers/selling-partner-api


RE: How to use Composer installed libs? - simoon - 12-02-2021

thanks, it works an i got it runing Smile


RE: How to use Composer installed libs? - captain-sensible - 12-02-2021

ok maybe you feedback on here what you are doing with it at a later date and its use