2017 © Pedro Peláez
 

library mandrill-api-php

A PHP client library for Mandrill's REST API

image

jlinn/mandrill-api-php

A PHP client library for Mandrill's REST API

  • Friday, November 27, 2015
  • by jlinn
  • Repository
  • 4 Watchers
  • 26 Stars
  • 15,304 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 1 Open issues
  • 8 Versions
  • 10 % Grown

The README.md

mandrill-api-php

Build Status, (*1)

A PHP client library for Mandrill's API., (*2)

This library provides all of the functionality present in the official PHP client, but makes use of namespaces and provides helper classes to ease message sending., (*3)

Installation Using Composer

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

php composer.phar require jlinn/mandrill-api-php:~1.0

Usage

Sending a Message

use Jlinn\Mandrill\Mandrill;
use Jlinn\Mandrill\Struct\Message;
use Jlinn\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);

Usage with Laravel 4.x

We have built a factory so that it's easier to use with Laravel 4.x facades., (*5)

Configuration

In order to publish the package configuration you need to perform the following command:, (*6)

php artisan config:publish jlinn/mandrill-api-php

Change then the secret variable with your Mandrill secret key., (*7)

Sending a Message

```php, (*8)

// instantiate a client object $api = Mandrill::api();, (*9)

// instantiate a message object $message = Mandrill::message([ 'text' => 'Hello, |NAME|!', 'subject' => 'Test', 'from_email' => 'test@example.com', 'from_name' => 'Mandrill API Test' ]);, (*10)

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

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

// send the message $response = $api->messages()->send($message);, (*13)

The Versions

27/11 2015

dev-master

9999999-dev

A PHP client library for Mandrill's REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

mandrill

27/11 2015

v1.1.1

1.1.1.0

A PHP client library for Mandrill's REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

mandrill

27/10 2015

v1.1.0

1.1.0.0

A PHP client library for Mandrill's REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

mandrill

17/10 2015

v1.0.4

1.0.4.0

A PHP client library for Mandrill's REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

mandrill

15/10 2015

v1.0.3

1.0.3.0

A PHP client library for Mandrill's REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

mandrill

17/12 2013

v1.0.2

1.0.2.0

A PHP client library for Mandrill's REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

mandrill

25/10 2013

v1.0.1

1.0.1.0

A PHP client library for Mandrill's REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

mandrill

16/09 2013

v1.0.0

1.0.0.0

A PHP client library for Mandrill's REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

mandrill