getbrevo/brevo-php
Legacy (v1.x) PHP SDK for Brevo API v3, auto-generated from OpenAPI/Swagger. Supports PHP 5.6+ and provides wrappers for Brevo features (email, contacts, campaigns, etc.). Maintained for critical security fixes only; migrate to brevo-php v4.
CreateBatchOrderResponse::$batchId now deserializes correctly. The createBatchOrder endpoint returns the batch id as batch_id (snake_case), but the SDK looked for batchId, leaving it unset and throwing Cannot assign null to property ...::$batchId of type float on every call. The wire mapping is corrected to batch_id and the property is now nullable (?float). The $response->batchId accessor is unchanged.Backward-compatible patch release. No breaking changes.
GetCampaignStats count fields are now nullable (?int): clickers, complaints, delivered, hardBounces, sent, softBounces, trackableViews, uniqueClicks, uniqueViews, unsubscriptions, viewed. This model is reused for statsByDomain on getEmailCampaign(s), where per-domain rows are sparse and the API returns null/absent for some counts. The previous non-nullable typing threw a TypeError while deserializing statsByDomain (globalStats was unaffected). (#138)Backward-compatible patch release. No breaking changes.
Backward compatible patch release. No breaking changes.
Release candidate for the v5 line. This pre-release is published so adopters can validate the new surface against their integrations before v5.0.0 is tagged stable. It is not picked up by composer update automatically — opt in explicitly (see Installing this RC below).
If no blocking issues surface within the soak window, this build will be promoted to v5.0.0 unchanged.
composer require getbrevo/brevo-php:^5.0.0@RC
RC — API surface is frozen. Only critical regressions discovered during soak will be patched into an RC.2.getbrevo/brevo-php if you hit anything unexpected during migration. Tag with v5-rc.Most of the breaking changes in v5 come from an internal effort at Brevo to make our API endpoints, parameters and models more self-descriptive. The goal is to make the public surface easier to read at a glance — both for developers and for AI agents working against the Brevo API — so that names, shapes and required fields convey intent without needing to cross-reference external docs. Concretely, this means consistent parameter naming, payload wrappers that reflect what the endpoint actually does (e.g. CreateBatchEventsRequest), filter keys that match the wire format, model fields renamed or removed where the previous names were ambiguous, and tightened types (DateTime instead of string for dates, typed unions instead of generic arrays) so static analysis catches mistakes earlier.
We're aware that renaming costs callers a one-time migration, and we've kept v4.x supported so you can adopt v5 on your own timeline.
Companies — GetCompaniesRequest::filters renamed
filters is renamed to filtersAttributesName to match the wire format.'filters' => ... does not throw, but the filter is silently ignored server-side and the response is unfiltered. Audit every call site.Events — Event::createBatchEvents payload shape changed
array to a CreateBatchEventsRequest wrapper.Balance — getActiveBalancesApi response shape changed
?BalanceLimit to ?GetLoyaltyBalanceProgramsPidActiveBalanceResponse (different shape).Balance — getContactBalances requires balanceDefinitionId
$request no longer defaults to empty; balanceDefinitionId is required.Balance — BeginTransactionRequest::eventTime type tightened
?string to ?DateTime. ISO strings now cause TypeError.CRM — Tasks::getAllTaskTypes returns an array
?GetCrmTasktypesResponse (wrapper) to ?array<GetCrmTasktypesResponseItem>.Email campaigns — utmIdActive renamed
EmailCampaigns\GetEmailCampaignResponse::utmIdActive renamed to utmId (wire key utmIDActive → utmID, type ?bool → ?int).GetEmailCampaignsResponseCampaignsItem.Model fields removed
GetAccountResponse::dateTimePreferencesWebhook::channelGetProcessResponseInfo::exportGetProcessResponse::error, ::createdAt, ::completedAtExternalFeeds response fieldsModel field types tightened
Process\GetProcessResponseInfoImport count fields changed from ?int to ?string (now URLs to CSV reports) — affects invalidEmails, duplicateContactId, duplicateExtId, and others.Ecommerce\CreateUpdateProductResponse::id and CreateUpdateCategoryResponse::id: ?int → ?string.string date fields tightened to ?DateTime (Program::*, Reward::*, BalanceLimit::createdAt/updatedAt).Model fields renamed
ConversationsMessageAttachmentsItem::fileName → name, ::inlineId → link.Custom objects — associations union flattened
UpsertrecordsRequestRecordsItemAssociationsItem is now a single class with an action: 'link' | 'unlink' discriminator. 7 old variant classes have been deleted.contacts->createContact, contacts->updateContact, emailCampaigns->getEmailCampaigns, ecommerce->getProducts, and several other endpoints.Composer only installs RC builds when you ask for them explicitly. Either:
composer require getbrevo/brevo-php:^5.0.0@RC
Or set minimum-stability in your composer.json:
{
"minimum-stability": "RC",
"prefer-stable": true,
"require": {
"getbrevo/brevo-php": "^5.0"
}
}
When v5.0.0 ships stable, composer update will swap this RC for the stable release automatically.
If you're not ready to migrate, pin to v4:
composer require getbrevo/brevo-php:^4.0
See the Upgrading from v4.x guide for full migration details.
getProcess / getProcesses — deserialization failure on completed processes (#121)
$duplicateEmailId was typed as ?int, but the API returns a URL string pointing to a CSV file of duplicate IDs.?string.getProcess / getProcesses — unknown status in_process (#122)
in_process value (v3 name for processing).GetProcessResponseStatus and GetProcessesResponseProcessesItemStatus now include InProcess = "in_process", so deserialization no longer throws on active processes.createEvent / createBatchEvents — boolean values rejected in contactProperties (#123)
contactProperties and eventProperties only accepted string|int.'MY_FLAG' => true) now serialize correctly.createContact / updateContact — integer values rejected in attributes (#124)
attributes values were typed as float|string|bool|array.int (e.g. 'OFFICE_ID' => 1234) now works without casting to (float).Summary
Resolved a field naming mismatch in the /orders/status/batch API response to align the implementation with the public contract.
Issue
During investigation of an L3 issue, a discrepancy was identified between the Swagger contract and the actual API response: • Contract (Swagger): batchId (camelCase) • Implementation: batch_id (snake_case)
This inconsistency caused misalignment with client expectations and SDK behavior.
Fix • Updated the response format to use batchId (camelCase) as defined in the Swagger specification. • Ensured consistency across API responses and documentation.
getEvents() — retrieve a paginated list of custom events, filterable by contactId, eventName, objectType, startDate, and endDate.limit (default 100, max 10,000) and offset for pagination.createBatchEvents() — create multiple events in a single request using an array of CreateBatchEventsRequestItem. Returns a BatchAcceptedResponse.CreateUpdateProductRequest and batch product upsert now accept two new optional fields: brand and description.getActiveBalancesApi() now accepts includeInternal to include balances tied to internal definitions.getContactBalances() and getSubscriptionBalances() now accept a request object with an includeInternal parameter.getTransactionHistory() now supports filtering by status (draft, completed, rejected, cancelled, expired) and transactionType (credit, debit).createBalanceDefinition() and updateBalanceDefinition():
meta field is now a typed object (isInternal: bool) instead of a generic key-value array.PatchCrmAttributesIdRequest to update CRM attribute labels and selectable option labels.metaInfo size limit for products clarified: maximum 20,000 characters total (previously documented as 1,000 KB / max 20 items).users field on plan verticals is now nullable.createContact() no longer throws a BrevoException$client->event->createBatchEvents() to track multiple contact interactions in a single requestexcludeHtmlContent parameter — getEmailCampaign() accepts a new optional flag to omit the HTML body from the response, reducing payload sizeUpdateContactRequest and CreateContactRequest now correctly serialize boolean values in union-typed attribute maps (float | string | bool | array). Previously threw JsonException: Cannot serialize value of type booleanOrder::products item type — OrderProductsItem now correctly exposes all product fields: price, productId, variantId, quantity, quantityFloat. Previously only quantity was accessibleGetCampaignStats nullable fields — appleMppOpens and opensRate are now correctly typed as nullable (?int, ?float), preventing TypeError when the API returns nullsendTransacSms() — Use sendAsyncTransactionalSms() instead. The synchronous method is deprecated. Note: remainingCredits is intentionally not returned by the async endpoint; use the account endpoints to retrieve credit balance2.1.4 → 2.1.103.91.2 → 4.22.0Full Changelog: https://github.com/getbrevo/brevo-php/compare/v4.0.6...v4.0.7
Introduction of loyalty endpoint to delete member subscription.
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v4.0.5...v4.0.6
Modernized, type-safe rewrite of the Brevo PHP client with a unified client architecture, PSR-18 compatibility, and built-in reliability features.
Brevo) replaces multiple API classes and manual configurationThis is a full rewrite of the SDK. v4.0.5 is not backwards compatible with v2.x.
Key breaking changes:
Configuration::getDefaultConfiguration() + per-API class instantiation) is replaced by a single Brevo client$message->setSubject(...)) is replaced by typed request objects with named constructorsBrevoApiException / BrevoException instead of Guzzle-specific exceptionsThe legacy v2.x SDK will continue to receive critical security updates but no new features. We strongly recommend migrating to v4.x.
Brevo as the single entry point$brevo->transactionalEmails->*, $brevo->contacts->*)Retry-After headers on rate-limited responses408, 429, 500, 502, 503, 504BrevoApiException for all non-2xx API responses with:
getCode() — HTTP status codegetMessage() — error messagegetBody() — parsed error response bodyBrevoException as a base for all SDK-level errorstry/catch branching by status codeRead more at https://developers.brevo.com/docs/api-clients/php
Modernized, type-safe rewrite of the Brevo PHP client with a unified client architecture, PSR-18 compatibility, and built-in reliability features.
Brevo) replaces multiple API classes and manual configurationThis is a full rewrite of the SDK. v4.0.3 is not backwards compatible with v2.x.
Key breaking changes:
Configuration::getDefaultConfiguration() + per-API class instantiation) is replaced by a single Brevo client$message->setSubject(...)) is replaced by typed request objects with named constructorsBrevoApiException / BrevoException instead of Guzzle-specific exceptionsThe legacy v2.x SDK will continue to receive critical security updates but no new features. We strongly recommend migrating to v4.x.
Brevo as the single entry point$brevo->transactionalEmails->*, $brevo->contacts->*)Retry-After headers on rate-limited responses408, 429, 500, 502, 503, 504BrevoApiException for all non-2xx API responses with:
getCode() — HTTP status codegetMessage() — error messagegetBody() — parsed error response bodyBrevoException as a base for all SDK-level errorstry/catch branching by status codeRead more at https://developers.brevo.com/docs/api-clients/php
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.13...v2.0.14
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.12...v2.0.13
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.11...v2.0.12
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.10...v2.0.11
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.9...v2.0.10
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.8...v2.0.9
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.7...v2.0.8
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.6...v2.0.7
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.5...v2.0.6
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.4...v2.0.5
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.3...v2.0.4
Update PHP-SDK for Contacts APIs.
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.1...v2.0.2
Full Changelog: https://github.com/getbrevo/brevo-php/compare/v2.0.0...v2.0.1
smtpLogMessageIdDelete() renamed to smtpLogIdentifierDelete()Full Changelog: https://github.com/getbrevo/brevo-php/compare/v1.0.2...v2.0.0
How can I help you explore Laravel packages today?