Skip to content
← Back to activity

Public problem

Brevo PHP SDK v4: PHP Fatal error Class "Brevo\Client\Configuration" not found

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

After upgrading from getbrevo/brevo-php 2.x to 4.x, existing code fatals with: PHP Fatal error: Uncaught Error: Class "Brevo\Client\Configuration" not found. The 2.x code built a Configuration object via Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey(...). That class only exists in the older SDK generation (1.x/2.x line) and the 4.x SDK does not ship it. To make it worse, the repo default branch README still showed the old Configuration-based setup at the time, which is where the confusion came from.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

In 4.x there is no Configuration object. Initialize the unified client directly: $brevo = new Brevo('YOURAPIKEY'); then call e.g. $brevo->transactionalEmails->sendTransacEmail(...). If you cannot migrate yet, pin composer.json to the 2.x line, but the team recommends moving to the modern client. Related fix from the same thread: campaign stats per-domain rows could return null counts and crash deserialization because fields were typed non-nullable; that is fixed in 4.0.15, so pull 4.0.15+ if you use getEmailCampaigns with statsByDomain.

Source: https://github.com/getbrevo/brevo-php/issues/138