Using third party package

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
btrade
User
Posts: 357

Using third party package

Post by btrade »

Hello. How can I connect this library?

TomorrowIdeas/plaid-sdk-php

I see this library in a packet. But I have errors in my a custom file.

[2022-07-27T06:16:39.231029+00:00] log.DEBUG: Slim Application Error Type: Error Code: 0 Message: Class "TomorrowIdeas\Plaid\Plaid" not found File: /home/finance/public_html/views/PlaidCreateLinkToken.php Line: 18 Trace: #0

use TomorrowIdeas\Plaid\Plaid;

$plaid = new Plaid(
\getenv("624ef7688b00b..........."),
\getenv("1d2db9e2ba2750faa4.........."),
\getenv("sandbox")
);

$auth = $plaid->auth->get($access_token);

print_r($auth);


mobhar
User
Posts: 11721

Post by mobhar »

Try to change this part:
$plaid = new Plaid(

to:
$plaid = new \Plaid(

and then try again.


btrade
User
Posts: 357

Post by btrade »

[2022-07-27T10:41:00.060988+00:00] log.DEBUG: Slim Application Error Type: Error Code: 0 Message: Class "Plaid" not found File: /home/finance/public_html/views/PlaidCreateLinkToken.php Line: 18 Trace: #0

use TomorrowIdeas\Plaid\Plaid;

$plaid = new \Plaid(
\getenv("624ef.........."),
\getenv("1d2db9e2ba2750f....a"),
\getenv("sandbox")
);

$auth = $plaid->auth->get($access_token);

print_r($auth);

No, I have this error.


arbei
User
Posts: 9384

Post by arbei »

As the error message said, the class is not found.

You need to add the package to the project and run composer update first, see Composer Package.


btrade
User
Posts: 357

Post by btrade »

I did it. But problem is not solved.

How can I check is connecting any library in my project?

I see this library in packet file .


arbei
User
Posts: 9384

Post by arbei »

If you do it correctly, you should find "tomorrow-ideas\plaid-sdk-php" in your "vendor" folder.

btrade wrote:

use TomorrowIdeas\Plaid\Plaid;
$plaid = new \Plaid(

If you use the "use" statement, just use new Plaid(...), see Using namespaces: Basics.


Post Reply