Download the PHP package getbrevo/brevo-php without Composer
On this page you can find all versions of the php package getbrevo/brevo-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package brevo-php
Brevo PHP Library
Official SDK for the Brevo API.
Table of Contents
- Documentation
- Requirements
- Installation
- Upgrading from v4.x
- Migration from v1.x
- Usage
- Exception Handling
- Advanced
- Custom Client
- Retries
- Timeouts
- Logging
- Contributing
Documentation
API reference documentation is available here.
Requirements
This SDK requires PHP ^8.1.
Installation
Upgrading from v4.x
v5 is a major release. Most breaking changes come from an internal effort at Brevo to make endpoints, parameters and models more self-descriptive — so names, shapes and required fields convey intent without needing to cross-reference external docs (both for developers and for AI agents working against the Brevo API).
v4.x remains supported. If you need to hold on v4 temporarily, pin it:
View v4 → v5 migration guide
### Breaking changes **Companies — `GetCompaniesRequest::filters` renamed** - `filters` is renamed to `filtersAttributesName` to match the wire format. - Existing code passing `'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** **Balance — `getActiveBalancesApi` response shape changed** - Return type changed from `?BalanceLimit` to `?GetLoyaltyBalanceProgramsPidActiveBalanceResponse`. **Balance — `getContactBalances` requires `balanceDefinitionId`** - `$request` no longer defaults to empty; `balanceDefinitionId` is required. **Balance — `BeginTransactionRequest::eventTime` type tightened** - Changed from `?string` to `?DateTime`. ISO strings now cause `TypeError`. **CRM — `Tasks::getAllTaskTypes` returns an array** (`?arrayMigration from v1.x
Warning: The legacy v1.x SDK will continue to receive critical security updates but no new features. We recommend migrating to v5.x.
View migration guide
**Key changes:** - Unified `Brevo` client with namespaced resources - Standardized error handling via `BrevoApiException` - PSR-18 HTTP client support **v1.x:** **v5.x:**Usage
Instantiate and use the client with the following:
Exception Handling
When the API returns a non-success status code (4xx or 5xx response), an exception will be thrown.
Advanced
Custom Client
This SDK is built to work with any HTTP client that implements the PSR-18 ClientInterface.
By default, if no client is provided, the SDK will use php-http/discovery to find an installed HTTP client.
However, you can pass your own client that adheres to ClientInterface:
Retries
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).
A request is deemed retryable when any of the following HTTP status codes is returned:
Use the maxRetries request option to configure this behavior.
Timeouts
The SDK does not configure a default timeout. Unless you set one, the underlying HTTP client's default applies (Guzzle, for example, defaults to no timeout). Set an explicit timeout (in seconds) at the client or request level:
Timeout forwarding is supported for Guzzle and Symfony HttpClient. Other PSR-18 clients ignore the
timeoutoption.
Logging
The SDK does not ship a built-in logger. Because the client option accepts any PSR-18 HTTP client, you can plug in any PSR-3 logger (Monolog, Symfony Logger, Laravel's Log facade) by wrapping that client with logging middleware. This keeps the SDK lean and lets you reuse the logger your application already configures.
Logging happens at the HTTP layer, so each SDK call produces one log line per HTTP request — including retries, which the SDK performs internally.
Warning: The
api-keyheader is sent on every request. If your message formatter includes request headers ({req_headers}), redact it before writing to disk or shipping to an external sink.
Contributing
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!
All versions of brevo-php with dependencies
ext-json Version *
psr/http-client Version ^1.0
psr/http-client-implementation Version ^1.0
psr/http-factory Version ^1.0
psr/http-factory-implementation Version ^1.0
psr/http-message Version ^1.1 || ^2.0
php-http/discovery Version ^1.0
php-http/multipart-stream-builder Version ^1.0