gulaandrij/mandrill-bundle
Composer 安装命令:
composer require gulaandrij/mandrill-bundle
包简介
Symfony Mandrill Bundle
README 文档
README
Send transactional mail through mandrill.com. This bundle provides an easy api for Symfony2 Projects.
All settings inside message class represent attributes of Mandrill's API. Please refer to their API documentation for Details:
https://mandrillapp.com/api/docs/messages.html
Prerequisites
Before you're able to use this bundle you must sign up with Mandrill.
Mandrill is a great way to send your transactional emails and provides detailed advances reports.
Mandrill is free for limited number of email per day, please read through pricing section on the website for more information:
Installation
Add the bundle to your composer.json
# composer.json { "require": { "slot/mandrill-bundle": "dev-master", } }
Run composer install
php ./composer.phar install
Enable the bundle in the kernel
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Slot\MandrillBundle\SlotMandrillBundle(),
);
}
Configuration
Add configuration to config.yml.
Log in to Mandrill and go to "Settings" -> "SMTP and API Credentials". Create an API Key and use it in your Symfony2 Configuration.
# config.yml slot_mandrill: api_key: xxxxx disable_delivery: true # useful for dev/test environment. Default value is 'false' # debug: passed to \Mandrill causing it to output curl requests. Useful to see output # from CLI script. Default value is 'false' debug: true default: sender: info@example.com sender_name: John Doe # Optionally define a sender name (from name) subaccount: Project # Optionally define a subaccount to use proxy: use: true # when you are behing a proxy. Default value is 'false' host: example.com port: 80 user: john password: doe123
Now you're all set, send your first transactional mails:
Use
Simple controller Example:
<?php // src/Slot/ExampleBundle/Controller/ExampleController.php namespace Slot\ExampleBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; use Slot\MandrillBundle\Message; use Slot\MandrillBundle\Dispatcher; class ExampleController extends Controller { public function indexAction() { $dispatcher = $this->get('slot_mandrill.dispatcher'); $message = new Message(); $message ->setFromEmail('mail@example.com') ->setFromName('Customer Care') ->addTo('max.customer@email.com') ->setSubject('Some Subject') ->setHtml('<html><body><h1>Some Content</h1></body></html>') ->setSubaccount('Project'); $result = $dispatcher->send($message); return new Response('<pre>' . print_r($result, true) . '</pre>'); } }
Using Handlebars
By default the bundle will assume the merge language is 'mailchimp'. You can
change this with $message->setMergeLanguage('handlebars')
gulaandrij/mandrill-bundle 适用场景与选型建议
gulaandrij/mandrill-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 03 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「email」 「mandrill」 「messages」 「transaction mail」 「transactional」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 gulaandrij/mandrill-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gulaandrij/mandrill-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 gulaandrij/mandrill-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Library to send email across all platforms using one interface.
An updated fork (psr-0 to psr-4) from the original library "Mandrill/Mandrill" (https://bitbucket.org/mailchimp/mandrill-api-php)
Magento2 email providers integration (smtp, mandrill, amazon ses)
Laravel 9+ Mandrill Driver & Webhooks handler
Magento2 email providers integration (smtp, mandrill, amazon ses)
Extensible library for building notifications and sending them via different delivery channels.
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-22