修订版-十 / sendinblue
为Symfony提供的非常简洁的Sendinblue集成
1.1.1
2022-11-11 12:00 UTC
Requires
- php: ^7.4.0|^8.1.0
- ext-json: *
- sendinblue/api-v3-sdk: 7.x.x
This package is auto-updated.
Last update: 2024-09-11 16:14:35 UTC
README
安装
通过composer安装
运行 composer req revision-ten/sendinblue
.
添加Bundle
将bundle添加到您的AppKernel(Symfony 3.4.*)或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],
配置
配置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.
用法
使用SendinblueService来订阅用户。
Symfony 3.4.* 示例
$sendinblueService = $this->container->get(SendinblueService::class); try { $subscribed = $sendinblueService->subscribe('dailyNewsletterCampagin', 'visitor.email@domain.tld', 'My Website', [ 'FNAME' => 'John', 'LNAME' => 'Doe', ]); } catch (Exception $e) { // ... }
或者取消用户订阅
$sendinblueService = $this->container->get(SendinblueService::class); $unsubscribed = $sendinblueService->unsubscribe('dailyNewsletterCampagin', 'visitor.email@domain.tld');