承接 freax/mandrill-zend2 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

freax/mandrill-zend2

最新稳定版本:2.1

Composer 安装命令:

composer require freax/mandrill-zend2

包简介

A PHP client library for Mandrill's REST API for Zend Framework 2 (>=2.5)

README 文档

README

A PHP ZF2 (>=2.5) client library for Mandrill's API.

This library provides all of the functionality present in the official PHP client, but makes use of namespaces, provides helper classes to ease message sending and works with Zend Framework 2 (>=2.5) (uses its library).

This library based on Joe Linn's library (https://github.com/jlinn/mandrill-api-php).

Installation Using Composer

Assuming composer.phar is located in your project's root directory, run the following command:

php composer.phar require freax/mandrill-zend2:2.*

Usage

Sending a Message

use Mandrill\Mandrill;
use Mandrill\Struct\Message;
use Mandrill\Struct\Recipient;

// instantiate a client object
$mandrill = new Mandrill('your_api_key');

// instantiate a Message object
$message = new Message();

// define message properties
$message->text = 'Hello, *|NAME|*!';
$message->subject = 'Test';
$message->from_email = 'test@example.com';
$message->from_name = 'Mandrill API Test';

// instantiate a Recipient object and add details
$recipient = new Recipient();
$recipient->email = 'recipient.email@example.com';
$recipient->name = 'Recipient Name';
$recipient->addMergeVar('NAME', $recipient->name);

// add the recipient to the message
$message->addRecipient($recipient);

// send the message
$response = $mandrill->messages()->send($message);

Sending a ZF2 Message

use Mandrill\Mandrill;
use Mandrill\Struct\Message;

// convert from ZF message
// $zfMessage is instance of \Zend\Mail\Message
$message = Message::convertZFMail($zfMessage);

// add any field you want
$message->metadata = ...;

// instantiate a client object
$mandrill = new Mandrill('your_api_key');

// send the message
$response = $mandrill->messages()->send($message);

统计信息

  • 总下载量: 3.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-26