PHPackages                             immobiliarelabs/braze-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. immobiliarelabs/braze-sdk

ActiveLibrary[API Development](/categories/api)

immobiliarelabs/braze-sdk
=========================

An sdk to interact with Braze API

v3.2.2(8mo ago)2189.1k↓27.6%51MITPHPPHP ^8.1CI passing

Since Jan 21Pushed 8mo ago5 watchersCompare

[ Source](https://github.com/immobiliare/braze-php-sdk)[ Packagist](https://packagist.org/packages/immobiliarelabs/braze-sdk)[ RSS](/packages/immobiliarelabs-braze-sdk/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (8)Versions (31)Used By (1)

Braze PHP SDK
=============

[](#braze-php-sdk)

[![CI](https://github.com/immobiliare/braze-php-sdk/workflows/CI/badge.svg)](https://github.com/immobiliare/braze-php-sdk/workflows/CI/badge.svg)[![codecov](https://camo.githubusercontent.com/d2014a5a286a8c3e1b356bee326a9286f0da2ea914c3dbba1a3eae700dcf5f9b/68747470733a2f2f636f6465636f762e696f2f67682f696d6d6f62696c696172652f6272617a652d7068702d73646b2f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d3848356445534a756971)](https://codecov.io/gh/immobiliare/braze-php-sdk)[![Latest Stable Version](https://camo.githubusercontent.com/a4ec4c6536e3f1ee4938919329f0c2e1a20456bcccd07ce33014c6d129fb6bd2/68747470733a2f2f706f7365722e707567782e6f72672f696d6d6f62696c696172656c6162732f6272617a652d73646b2f76)](https://packagist.org/packages/immobiliarelabs/braze-sdk)[![Total Downloads](https://camo.githubusercontent.com/771f8cbea30ddfb1288f8ab18fe52a19ce23c20555ad703834bc1a3c6a5d422f/68747470733a2f2f706f7365722e707567782e6f72672f696d6d6f62696c696172656c6162732f6272617a652d73646b2f646f776e6c6f616473)](https://packagist.org/packages/immobiliarelabs/braze-sdk)[![Latest Unstable Version](https://camo.githubusercontent.com/1481bb6a9208beebfcc32f1b80b92fe00cdc159fb0323c30b555d8f7414a5eb8/68747470733a2f2f706f7365722e707567782e6f72672f696d6d6f62696c696172656c6162732f6272617a652d73646b2f762f756e737461626c65)](https://packagist.org/packages/immobiliarelabs/braze-sdk)[![License](https://camo.githubusercontent.com/a420cd405bfa9cc9d8424a5693096ff5840e182152727d66ba6077f6104ccbc0/68747470733a2f2f706f7365722e707567782e6f72672f696d6d6f62696c696172656c6162732f6272617a652d73646b2f6c6963656e7365)](https://packagist.org/packages/immobiliarelabs/braze-sdk)[![PHP Version Require](https://camo.githubusercontent.com/bb450987ce30f92212d85746a01e64378984cd6eba2bc788d0d5d76363d24470/68747470733a2f2f706f7365722e707567782e6f72672f696d6d6f62696c696172656c6162732f6272617a652d73646b2f726571756972652f706870)](https://packagist.org/packages/immobiliarelabs/braze-sdk)

> A PHP client to interact with Braze API

[Braze](https://www.braze.com/) offers a cloud-based customer engagement platform for multichannel marketing. This SDK allows you to integrate its REST API into a PHP application.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Install](#install)
- [Usage](#usage)
    - [Example](#example)
    - [Endpoints](#endpoints)
    - [Validation and dry-run](#validation-and-dry-run)
    - [HTTP client adapter](#http-client-adapter)
    - [Parallel requests](#parallel-requests)
- [Compatibility](#compatibility)
- [Requirements](#requirements)
- [Powered Apps](#powered-apps)
- [Contributing](#contributing)
- [Changelog](#changelog)
- [License](#license)

Features
--------

[](#features)

- Explicit representation of the API contract to write requests easily using the IDE autocomplete
- Formal validation (strict and non-strict) of requests
- Dry-run mode to simulate requests and validate them without actually performing calls
- Ability to use any http client via an adapter. For PSR-18 compatible clients and the Symfony client, adapters are included in the SDK
- Parallel API calls supported if the http client allows it (for example the Symfony one)

Install
-------

[](#install)

Add the SDK as a dependency running:

```
composer require immobiliarelabs/braze-sdk
```

If not already included in your project, to make http requests, you need to install any combination of packages that implements:

- [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) or [`symfony/http-client-contracts`](https://packagist.org/providers/symfony/http-client-contracts)
- [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation)
- [`psr/http-message-implementation`](https://packagist.org/providers/psr/http-message-implementation)

for example by installing `symfony/http-client` and `nyholm/psr7` you are ready to use the SDK, also with parallel requests.

Alternatively, it is also possible to use any http client by creating the appropriate adapter.

Usage
-----

[](#usage)

### Example

[](#example)

Before instantiating the SDK it is necessary to create the http client and its adapter.

```
use ImmobiliareLabs\BrazeSDK\ClientAdapter\SymfonyAdapter;
use Symfony\Component\HttpClient\HttpClient;

$client = HttpClient::create();
$adapter = new SymfonyAdapter($client);
```

This example is for the Symfony http client, but the flow is the same whether you are using a PSR-18 client or a custom one. Then you can create the SDK instance.

```
use ImmobiliareLabs\BrazeSDK\Braze;
use ImmobiliareLabs\BrazeSDK\Region;

$braze = new Braze($adapter, 'my-api-key', Region::EU01);
```

Now you can start making requests by creating one and passing it to the appropriate endpoint.

```
use ImmobiliareLabs\BrazeSDK\Object\Event;
use ImmobiliareLabs\BrazeSDK\Request\Users\TrackRequest;

$event = new Event();
$event->external_id = 'user-id';
$event->app_id = 'app-id';
$event->name = 'event-name';
$event->time = new \DateTimeImmutable();
$event->properties = ['property' => 'property-value'];

$request = new TrackRequest();
$request->events = [$event];

$response = $braze->users()->track($request, false);
```

You can also set connection and overall timeout.

```
$braze->setConnectionTimeout(2.0);
$braze->setOverallTimeout(3.0);
```

Currently, SymfonyAdapter supports them, while Psr18Adapter does not.

You can see a few complete [examples](./examples) in the repository.

### Custom user attributes

[](#custom-user-attributes)

To set custom User attributes use the `setCustomAttribute` or `setCustomAttributes` methods available in the `UserAttributes` class.

```
use ImmobiliareLabs\BrazeSDK\Object\UserAttributes;

$userAttributes = new UserAttributes();
$userAttributes->external_id = 'user-id';
$userAttributes->first_name = 'Name';

$userAttributes->setCustomAttribute('custom_int_property', 47);

$userAttributes->setCustomAttributes([
    'custom_string_property' => 'properyValue',
    'custom_bool_property' => false,
]);

$request = new TrackRequest();
$request->attributes = [$userAttributes];

$response = $braze->users()->track($request, false);
```

### Endpoints

[](#endpoints)

Endpoints are organized by url prefix. The SDK supports all the Braze endpoints:

- users
- campaigns
- canvas
- messages
- content\_blocks
- templates
- email
- events
- feed
- purchases
- sessions
- sends
- transactional
- subscription

### Validation and dry-run

[](#validation-and-dry-run)

The SDK does a formal validation of the request before executing it. It is however possible to disable it completely:

```
$braze->setValidation(false);
```

or just the strict one, since Braze partially executes requests when possible:

```
$braze->setValidation(true, false);
```

By default, the SDK performs strict validation.

If you want to validate your requests without sending them to Braze you can enable dry-run mode:

```
$braze->setDryRun(true);
```

### HTTP client adapter

[](#http-client-adapter)

If, in your project, you already have a http client which does not implement one of the two supported interfaces (Symfony and PSR18), and you don't want to install another one, just define an adapter that implements the `ImmobiliareLabs\BrazeSDK\ClientAdapter\ClientAdapterInterface` interface, and use it when instantiate the SDK.

### Parallel requests

[](#parallel-requests)

If the chosen http client supports asynchronous calls, you can exploit that to make parallel requests to Braze in this way:

```
$response1 = $braze->users()->track($request1, true);
$response2 = $braze->users()->track($request2, true);

$braze->flush();
```

The response objects will be filled with the values obtained only after the call to flush.

Compatibility
-------------

[](#compatibility)

VersionStatusPHP compatibility1.xunmaintained`>=7.2`2.xmaintained`>=8.0`3.xmaintained`>=8.1`Requirements
------------

[](#requirements)

- ext-json

Powered Apps
------------

[](#powered-apps)

Braze PHP SDK was created by the PHP team at [ImmobiliareLabs](https://labs.immobiliare.it/), the Tech dept of [Immobiliare.it](https://www.immobiliare.it), the #1 real estate company in Italy.

We are currently using this SDK to stay in touch with our users.

**If you are using Braze PHP SDK in production [drop us a message](mailto:opensource@immobiliare.it)**.

Contributing
------------

[](#contributing)

Any questions, bug reports or suggestions for improvement are very welcome. See the [contributing](./CONTRIBUTING.md) file for details on how to contribute.

Changelog
---------

[](#changelog)

Please refer to the [changelog notes](CHANGELOG.md).

License
-------

[](#license)

Braze PHP SDK is licensed under the MIT license.
See the [LICENSE](./LICENSE) file for more information.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance61

Regular maintenance activity

Popularity41

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 66.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~75 days

Recently: every ~93 days

Total

20

Last Release

244d ago

Major Versions

v1.2.0 → v2.0.02022-03-30

v1.3.0 → v2.2.02023-08-29

v1.3.1 → v2.2.12023-12-19

v2.5.0 → v3.0.02024-11-23

PHP version history (3 changes)v1.0.0PHP ^7.2 || ^8.0

v2.0.0PHP ^8.0

v3.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8dab7be39a6adf2b47f924eed2d1cc45b1e37e292557f4395961a00651d3bff5?d=identicon)[JellyBellyDev](/maintainers/JellyBellyDev)

![](https://www.gravatar.com/avatar/573faa69bb56ed78be26666625a82f4f98475884f941ff8a1b4aa33ece878d24?d=identicon)[antonio.turdo](/maintainers/antonio.turdo)

---

Top Contributors

[![antonioturdo](https://avatars.githubusercontent.com/u/1651072?v=4)](https://github.com/antonioturdo "antonioturdo (41 commits)")[![JellyBellyDev](https://avatars.githubusercontent.com/u/190820?v=4)](https://github.com/JellyBellyDev "JellyBellyDev (12 commits)")[![Trusted97](https://avatars.githubusercontent.com/u/37697178?v=4)](https://github.com/Trusted97 "Trusted97 (5 commits)")[![senzidee](https://avatars.githubusercontent.com/u/11656366?v=4)](https://github.com/senzidee "senzidee (3 commits)")[![matteobaccan](https://avatars.githubusercontent.com/u/200925?v=4)](https://github.com/matteobaccan "matteobaccan (1 commits)")

---

Tags

api-clientbrazebraze-apibraze-sdkclientclient-libraryhacktoberfestphpsdksdk-phpclientsdkapi clientbrazeclient librarysdk-phpbraze-apibraze-sdk

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/immobiliarelabs-braze-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/immobiliarelabs-braze-sdk/health.svg)](https://phpackages.com/packages/immobiliarelabs-braze-sdk)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k29.9M347](/packages/openai-php-client)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36826.2k2](/packages/telnyx-telnyx-php)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)[cakephp/cakephp

The CakePHP framework

8.9k20.0M1.9k](/packages/cakephp-cakephp)[getbrevo/brevo-php

Official PHP SDK for the Brevo API.

1004.1M59](/packages/getbrevo-brevo-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
