Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php error #35

Open
Ort0x36 opened this issue Dec 8, 2023 · 1 comment
Open

php error #35

Ort0x36 opened this issue Dec 8, 2023 · 1 comment

Comments

@Ort0x36
Copy link

Ort0x36 commented Dec 8, 2023

Fatal error: Uncaught Error: Class 'PagarmeApiSDKClientBuilder' not found in /var/www/html/testing_pagarme_client.php:4 Stack trace: #0 {main} thrown in /var/www/html/testing_pagarme_client.php on line 4

<?php
require('vendor/autoload.php');

$client = PagarmeApiSDKClientBuilder::init()
    ->basicAuthUserName('sk_test_*')
    ->basicAuthPassword('')
    ->serviceRefererName('')
    ->build();

$transaction = $client->getTransactionsController();

echo '<pre>';
var_dump($transaction);
@ctestonjung
Copy link

I faced the same issue. Here's a solution:

The composer.json file contains the following PSR-4 autoloading configuration:

"autoload": {
  "psr-4": {
    "PagarmeApiSDKLib\\": "src/"
  }
},

This means it will load PagarmeApiSDKLib namespace from the src folder.

Inside the folder that contains src, vendor and the composer.json file, you should run:

composer dump-autoload

In your code, you will then be able to add a use statement including PagarmeApiSDKLib\PagarmeApiSDKClientBuilder symbol or just call it using it's fully qualified class name, like in the following sample:

//use PagarmeApiSDKLib\PagarmeApiSDKClientBuilder;

require_once './vendor/autoload.php';

$client = PagarmeApiSDKLib\PagarmeApiSDKClientBuilder::init()
    ->basicAuthUserName('BasicAuthUserName')
    ->basicAuthPassword('BasicAuthPassword')
    ->serviceRefererName('ServiceRefererName')
    ->build();

I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants