tutorauk/laravel-braze-api

A Laravel client for the Braze REST API

v0.2 2023-07-27 12:39 UTC

README

Laravel Braze

Latest Version on Packagist GitHub Tests Action Status GitHub Tests Action Status GitHub Tests Action Status Total Downloads MIT Licensed

Laravel wrapper around the immobiliare/braze-php-sdk package.

Installation

You can install the package via composer:

composer require tutorauk/laravel-braze-api

Then you need to your Braze api key and the correct rest endpoint to your .env file:

BRAZE_API_KEY='apiKey'
BRAZE_REST_ENDPOINT=https://rest.fra-02.braze.eu

Http Client Adapters

This package has support for the Laravel HTTP Client or Guzzle. The Laravel HTTP Client is the default and preferred client. Utilising the Laravel client, enables you to take advantage of Laravels testing helpers within your tests.

If you would prefer to use Guzzle, you can specify the adapter in your .env file:

BRAZE_CLIENT_ADAPTER=guzzle

Usage

This package binds a singleton to the Laravel service container, so you can easily resolve the Braze client directly from the container, or via dependency injection. Alternatively, the package also exposes both a Facade and a helper function should you prefer a shorter more expressive option.

// Resolve service directly from container and access the users endpoint
app(Braze::class)->users();

// Resolve via Facade and access the users endpoint
Braze::users(); 

// Resolve service via helper and access the users endpoint
braze()->users();

Testing, Static Analysis and Formatting

composer test
composer analyse
composer format

Thanks

Big shout out to Immobiliare Labs for their Braze PHP SDK package. They did all the hard work 👏!

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.