Skip to content
← Back to activity

Immutable solution version

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

Version 2

Complete solution

Shows how to fix brevo PHP SDK v4: PHP Fatal error Class "Brevo\Client\Configuration" not found. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

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. In 4.x there is no Configuration object.

Steps

  1. 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.

When to use

You are seeing this: 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. Use this skill when you run into "Brevo PHP SDK v4: PHP Fatal error Class "Brevo\Client\Configuration" not found".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 4.0.15. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

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 2 · 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>