2017-25 © Pedro Peláez
 

library mailgun-zend3

A PHP client library for Mailgun's REST API for Zend Framework 3

image

awsm3/mailgun-zend3

A PHP client library for Mailgun's REST API for Zend Framework 3

  • Wednesday, June 6, 2018
  • by AWSM3
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Mailgun API for Zend Framework 3

A PHP ZF3 client library for Mailgun's API., (*1)

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 3 (uses its library)., (*2)

Installation Using Composer

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

composer require awsm3/mailgun-zend3

Usage

Sending a Message

/** @uses */
use ZendMailgun\{
    Mailgun,
    Struct\Message,
    Struct\Sender,
    Struct\Recipient,
    Struct\RecipientsList
}

// Instantiate a client object
$transport = new Mailgun('your_api_key');

// Instantiate a sender
$sender = new Sender('test@example.com', 'Your name');

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

// Define message properties
$message->setText('Hello, username');
$message->setSubject('Test');
$message->setFrom($sender->prepare());

// Instantiate a Recipient object and add details
$recipient = new Recipient();
$recipient->setEmail('recipient.email@example.com');
$recipient->setName('Recipient Name');

// Add the recipient to the message
$message->setTo($recipient->prepare());

// Or make recipients list
$recipientsList = new RecipientsList(
    new Recipient('recipient-1@mail.com', 'Recipient 1'),
    new Recipient('recipient-2@mail.com', 'Recipient 2'),
);
$message->setTo($recipientsList->prepare());

// Send the message
$response = $transport->messages()->send('your-domain', $message);

Sending a ZF3 Message

/** @uses */
use ZendMailgun\{
    Mailgun,
    Struct\Message,
    Struct\Sender,
    Struct\Recipient,
    Struct\RecipientsList
}

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

// Instantiate a client object
$transport = new Mailgun('your_api_key');

// send the message
$response = $transport->messages()->send('your-domain', $message);

The Versions

06/06 2018

dev-master

9999999-dev

A PHP client library for Mailgun's REST API for Zend Framework 3

  Sources   Download

MIT

The Requires

 

The Development Requires

zend framework zf3 mailgun zend framework 3

06/06 2018

0.1.0

0.1.0.0

A PHP client library for Mailgun's REST API for Zend Framework 3

  Sources   Download

MIT

The Requires

 

The Development Requires

zend framework zf3 mailgun zend framework 3