revision-ten / sendinblue
A very minimal Sendinblue integration for Symfony
Installs: 1 013
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.4.0|^8.1.0
- ext-json: *
- getbrevo/brevo-php: 2.x.x
This package is auto-updated.
Last update: 2024-12-06 09:25:18 UTC
README
Installation
Install via composer
Run composer req revision-ten/sendinblue
.
Add the Bundle
Add the bundle to your AppKernel (Symfony 3.4.*) or your Bundles.php (Symfony 4.*).
Symfony 3.4.* /app/AppKernel.php:
new \RevisionTen\Sendinblue\Sendinblue\Bundle(),
Symfony 4.* /config/bundles.php:
RevisionTen\Sendinblue\SendinblueBundle::class => ['all' => true],
Configuration
Configure the bundle:
# sendinblue example config. sendinblue: api_key: 'XXXXXXXXXXXXXXXXXXXXXXX-us5' # Your sendinblue api key. campaigns: dailyNewsletterCampagin: list_id: 12345 # ID of your newsletter list. doi_template_id: 123 # ID of your double opt-in template.
Usage
Use the SendinblueService to subscribe users.
Symfony 3.4.* example:
$sendinblueService = $this->container->get(SendinblueService::class); try { $subscribed = $sendinblueService->subscribe('dailyNewsletterCampagin', 'visitor.email@domain.tld', 'My Website', [ 'FNAME' => 'John', 'LNAME' => 'Doe', ]); } catch (Exception $e) { // ... }
Or unsubscribe users:
$sendinblueService = $this->container->get(SendinblueService::class); $unsubscribed = $sendinblueService->unsubscribe('dailyNewsletterCampagin', 'visitor.email@domain.tld');