Skip to content

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

@Phil56450

Description

@Phil56450

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions