Download the PHP package designbycode/laravel-brevo without Composer
On this page you can find all versions of the php package designbycode/laravel-brevo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download designbycode/laravel-brevo
More information about designbycode/laravel-brevo
Files in designbycode/laravel-brevo
Package laravel-brevo
Short Description wrapper for brevo-php
License MIT
Homepage https://github.com/designbycode/laravel-brevo
Informations about the package laravel-brevo
Overview
The LaravelBrevo package is a Laravel wrapper for integrating with the Brevo API (formerly Sendinblue). It simplifies interactions with Brevo's email marketing and contact management features, allowing you to manage contacts, subscribe/unsubscribe users, and retrieve contact information seamlessly within your Laravel application.
This version of the documentation demonstrates how to use the package via the Facade for cleaner and more expressive code.
Use Cases
This package is ideal for:
-
Email Marketing:
- Subscribe users to mailing lists.
- Unsubscribe users from mailing lists.
- Update user attributes (e.g., name, preferences).
-
Contact Management:
- Retrieve contact details.
- Create or update contacts in Brevo.
- Automation:
- Automatically add new users to Brevo lists during registration.
- Sync user data between your application and Brevo.
Support us
Installation
You can install the package via composer:
You can publish the config file with:
Add your Brevo API key to the .env file:
Configuration
` api_key: Your Brevo API key. This is required to authenticate API requests.
Usage
Retrieve Contact Information.
To retrieve details for a specific contact by email:
Subscribe a Contact
To subscribe a contact to a mailing list:
Unsubscribe a Contact
To unsubscribe a contact from a mailing list:
Methods
Brevo::getContactInfo(string $email): ?GetExtendedContactDetails
- Retrieves contact details for the specified email.
- Returns
null
if the contact is not found.
Brevo::subscribe(string $email, int $listId, array $attributes = []): bool
- Subscribes a contact to a mailing list.
- Creates a new contact if they don't exist, or updates an existing contact.
- Returns
true
on success,false
on failure.
Brevo::unsubscribe(string $email, int $listId): bool
- Unsubscribes a contact from a mailing list.
- Returns
true
on success,false
on failure.
Error Handling
The package handles API errors gracefully:
- 404 Not Found: Logs a warning and returns
null
orfalse
. - 500 Server Error: Logs an error and returns
false
. - Other exceptions are logged and handled appropriately.
Testing
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
- Claude Myburgh
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-brevo with dependencies
getbrevo/brevo-php Version ^2.0
illuminate/contracts Version ^10.0||^11.0
spatie/laravel-package-tools Version ^1.16