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

Uncaught Error: Class 'Brevo\Client\Configuration' not found #268

Open
Phil56450 opened this issue Jan 29, 2025 · 0 comments
Open

Uncaught Error: Class 'Brevo\Client\Configuration' not found #268

Phil56450 opened this issue Jan 29, 2025 · 0 comments

Comments

@Phil56450
Copy link

Hello Community Friend.
I come to this because it seems to me that the error is not resolved.

Fatal error: Uncaught Error: Class 'Brevo\Client\Configuration' not found
Error: Class 'Brevo\Client\Configuration' not found

composer json : { "require": { "getbrevo/brevo-php": "2.0.4" } }

AND the code

`require_once('vendor/autoload.php');

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'XXX MY HAPPY KEY YYY ');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\ContactsApi(
// If you want use custom http client, pass your client which implements GuzzleHttp\ClientInterface.
// This is optional, GuzzleHttp\Client will be used as default.
new GuzzleHttp\Client(),
$config
);
$createContact = new \Brevo\Client\Model\CreateContact([
'email' => $email,
'updateEnabled' => true,
'attributes' => [[ 'FIRSTNAME' => $first_name, 'LASTNAME' => $last_name, 'USER_ID' => $id_user, 'isVIP'=> 'true' ]],
'listIds' =>[[39]]
]); // \Brevo\Client\Model\CreateContact | Values to create a contact

try {
$result = $apiInstance->createContact($createContact);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ContactsApi->createContact: ', $e->getMessage(), PHP_EOL;
}`

Thank you in advance for your support

Philippe

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

1 participant