mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-25 14:26:04 +03:00
Adjusted readme and exceptions
This commit is contained in:
parent
90f808df81
commit
4ca9d8b08d
13
README.md
13
README.md
@ -2,7 +2,8 @@ Mailgun-PHP-SDK
|
|||||||
===========
|
===========
|
||||||
[![Build Status](https://magnum.travis-ci.com/travelton/Mailgun-PHP.png?token=3stPWthMYq4p7xpVNV9Y&branch=master)](https://magnum.travis-ci.com/travelton/Mailgun-PHP)
|
[![Build Status](https://magnum.travis-ci.com/travelton/Mailgun-PHP.png?token=3stPWthMYq4p7xpVNV9Y&branch=master)](https://magnum.travis-ci.com/travelton/Mailgun-PHP)
|
||||||
|
|
||||||
This is the Mailgun PHP SDK. This SDK contains methods for easily interacting with the Mailgun API. Below are examples to get you started.
|
This is the Mailgun PHP SDK. This SDK contains methods for easily interacting with the Mailgun API. Below are examples to get you started. For additional examples,
|
||||||
|
please see our SDK documentation at http://documentation.mailgun.com
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
-----
|
-----
|
||||||
@ -15,7 +16,7 @@ curl -sS https://getcomposer.org/installer | php
|
|||||||
# Add Mailgun as a dependency
|
# Add Mailgun as a dependency
|
||||||
php composer.phar require mailgun/mailgun-php-sdk:~1.0
|
php composer.phar require mailgun/mailgun-php-sdk:~1.0
|
||||||
```
|
```
|
||||||
Next, require Composer's autoloader to automatically load the Mailgun SDK in your project:
|
Next, require Composer's autoloader, in your application, to automatically load the Mailgun SDK in your project:
|
||||||
```PHP
|
```PHP
|
||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
```
|
```
|
||||||
@ -24,7 +25,7 @@ Usage
|
|||||||
-----
|
-----
|
||||||
Using the SDK should feel simple, if you're already familiar with our API endpoints. If not, no problem... When you're reviewing our documentation, the endpoints are expressed as a class in the SDK to make things easier.
|
Using the SDK should feel simple, if you're already familiar with our API endpoints. If not, no problem... When you're reviewing our documentation, the endpoints are expressed as a class in the SDK to make things easier.
|
||||||
|
|
||||||
Here's an example for sending a message:
|
For example, here's how to use the "Messages" API endpoint:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
# First, instantiate the client with your API credentials and domain.
|
# First, instantiate the client with your API credentials and domain.
|
||||||
@ -48,7 +49,7 @@ Advanced Usage
|
|||||||
You've sent your first message, awesome! Let's move on to more advanced use cases.
|
You've sent your first message, awesome! Let's move on to more advanced use cases.
|
||||||
|
|
||||||
#### Message Builder
|
#### Message Builder
|
||||||
Message Builder makes creating your messages really intuitive. If you despise arrays, or your workflow is better off defining each part of the MIME separately, use this!
|
Message Builder makes creating your messages really intuitive. If you despise arrays, or your workflow is better off defining each part of the message separately, use Message Builder!
|
||||||
|
|
||||||
```php
|
```php
|
||||||
# First, instantiate the client with your API credentials and domain.
|
# First, instantiate the client with your API credentials and domain.
|
||||||
@ -81,7 +82,9 @@ $message->sendMessage();
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### Batch Sending
|
#### Batch Sending
|
||||||
Batch sending allows you to submit up to 1,000 messages per API call. This is the best way to send a large amount of messages as quickly as possible. In the example below, we'll use the Message Builder object to create a message. While Message Builder is the preferred method, you can also run "setMessage()" and pass a fully formed array of data.
|
Batch sending allows you to submit up to 1,000 messages per API call. This is the best way to send a large amount of messages as quickly as possible. In the example below, we'll use the Message Builder object to create a message.
|
||||||
|
|
||||||
|
_Note: While Message Builder is the preferred method, you can also run "setMessage()" (see above example) to pass a fully formed array of data._
|
||||||
|
|
||||||
```php
|
```php
|
||||||
# First, instantiate the client with your API credentials and domain.
|
# First, instantiate the client with your API credentials and domain.
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
namespace Mailgun\Messages\Exceptions;
|
||||||
|
|
||||||
|
class MissingRequiredMIMEParameters extends \Exception{}
|
||||||
|
|
||||||
|
?>
|
@ -1,13 +0,0 @@
|
|||||||
<?PHP
|
|
||||||
|
|
||||||
|
|
||||||
const API_VERSION = "v2";
|
|
||||||
const API_ENDPOINT = "api.mailgun.net";
|
|
||||||
const API_USER = "api";
|
|
||||||
const SDK_VERSION = "0.1";
|
|
||||||
const SDK_USER_AGENT = "mailgun-sdk-php";
|
|
||||||
const DEFAULT_TIME_ZONE = "UTC";
|
|
||||||
const DEFAULT_MG_API_KEY = "key-3ax6xnjp29jd6fds4gc373sgvjxteol0";
|
|
||||||
const DEFAULT_MG_DOMAIN = "samples.mailgun.org";
|
|
||||||
|
|
||||||
?>
|
|
Loading…
Reference in New Issue
Block a user