allprogrammic / sendinblue-bundle
Symfony SendinblueBundle
dev-master / 1.0.x-dev
2017-11-03 11:00 UTC
Requires
- php: ^5.5.9 || ^7.0
- guzzlehttp/guzzle: ^6.2
- symfony/framework-bundle: ^2.7 || ^3.0 || ^4.0
- symfony/serializer: ^2.7 || ^3.0 || ^4.0
This package is auto-updated.
Last update: 2024-09-17 20:09:56 UTC
README
此包提供与 Sendinblue 邮件代理集成的功能和 API 客户端,用于 Symfony
安装
在项目中获取依赖关系
composer require allprogrammic/sendinblue-bundle
启用包。在 AppKernel.php 中
public function registerBundles() { $bundles = [ // ... new AllProgrammic\Bundle\SendinBlueBundle\AllProgrammicSendinBlueBundle(), // ... ]; }
配置
在这里获取您的 Sendinblue API 密钥 here,并将其添加到您的 config.yml 中
sendinblue: api: key: 'your key'
您也可以通过 parameters.yml 文件设置它。
parameters.yml
parameters: sendinblue_api_key: 'your key'
config.yml
sendinblue: api: key: '%sendinblue_api_key%'
用法
此包提供了一个名为 'sendinblue.api.client' 的服务,用于与 Sendinblue API 交互。
示例:检索您的账户数据
$this->get('sendinblue.api.client')->getAccount();
示例:发送事务性消息
$message = new \AllProgrammic\Bundle\SendinBlueBundle\Api\TransactionalMessage('my subject'); $message ->from('test@test.com', 'My Company') ->addTo('john.doe@acme.com') ->html($this->renderView('mytemplate.html.twig')) ->text($this->renderView('mytemplate.txt.twig')); $this->get('sendinblue.api.client')->sendTransactional(message);