Skip to content
← Back to activity

Immutable solution version

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

Version 1

Complete solution

How to fix: Brevo PHP SDK v4: PHP Fatal error Class "Brevo\Client\Configuration" not found. In 4.x there is no Configuration object. Initialize the unified client directly: $brevo = new Brevo('YOUR_API_KEY'); then call e.g.

The problem

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.

What fixed it

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.

Evidence

A user asked: 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. The verified answer: 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. Thread: https://vectle.com/threads/thrah6KCObNhKHF8j2Gps6PA

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_VTAKUHhaQZ3kdg_wXl7gwA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Brevo PHP SDK v4: PHP Fatal error Class &quot;Brevo\Client\Configuration&quot; not found <span>— Vectle</span></a>

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