beanstalkhq / laramandrill
2.1.1
2016-06-06 20:55 UTC
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: 6.0.*
- illuminate/support: ~5.0
README
Laravel Mandrill 插件!
版本 1.x - 用于 Laravel 4.x
版本 2.x - 用于 Laravel 5.x
此laravel插件基于MichMich的插件,但针对composer和一些其他功能进行了优化。
此包是用于处理Mandrill API的简单包装器。
安装
首先通过Composer安装此包。编辑项目的composer.json
文件,以要求CanopyTax/laramandrill
。
"require": {
"CanopyTax/laramandrill": "~2.0"
}
接下来,从终端更新Composer
composer update
此操作完成后,最后一步是添加服务提供者。打开config/app.php
,并将新项目添加到providers数组中。
'CanopyTax\Laramandrill\LaramandrillServiceProvider'
将此行添加到config/app.php
中的aliases
数组中
'Laramandrill' => 'CanopyTax\Laramandrill\Facades\Laramandrill'
最后,您需要添加您的Mandrill API密钥。生成配置文件,并在{root}/config/laramandrill.php中编辑它
使用方法
调用所需的方法,并将参数作为单个数组传递。无需担心传递API密钥。
$response = Laramandrill::request('post', 'messages/send', array( 'message' => array( 'html' => 'Body of the message.', 'subject' => 'Subject of the message.', 'from_email' => 'monkey@somewhere.com', 'to' => array(array('email'=>'foo@bar.com')), ), ));