added mailgun librarie

This commit is contained in:
Bachir Soussi Chiadmi
2016-07-19 19:58:07 +02:00
parent deae7e0b59
commit 918b4cd5e1
18 changed files with 275 additions and 753 deletions

View File

@@ -22,32 +22,12 @@ composer and the Mailgun SDK.
curl -sS https://getcomposer.org/installer | php
# Add Mailgun as a dependency
php composer.phar require mailgun/mailgun-php:~2.0
```
You do also need to choose what library to use when you are sending http messages. Consult the
[php-http/client-implementation](https://packagist.org/providers/php-http/client-implementation) virtual package to
find adapters to use. For more information about virtual packages please refer to
[Httplug](http://docs.httplug.io/en/latest/virtual-package/). Example:
```bash
php composer.phar require php-http/guzzle6-adapter:^1.0
```
When creating a new `Mailgun` object you must provide an instance of the `HttpClient`.
```php
$client = new \Http\Adapter\Guzzle6\Client();
$mailgun = new \Mailgun\Mailgun('api_key', $client);
```
You could also rely on the [auto discovery feature of Httplug](http://docs.php-http.org/en/latest/discovery.html). This
means that you need to install `puli/composer-plugin` and put a puli.phar in your project root.
php composer.phar require mailgun/mailgun-php:~1.7.1
```
**For shared hosts without SSH access, check out our [Shared Host Instructions](SharedHostInstall.md).**
**Rather just download the files? [Library Download](https://9f67cbbd1116d8afb399-7760483f5d1e5f28c2d253278a2a5045.ssl.cf2.rackcdn.com/mailgun-php-1.7.2.zip).**
**Rather just download the files? [Library Download](https://9f67cbbd1116d8afb399-7760483f5d1e5f28c2d253278a2a5045.ssl.cf2.rackcdn.com/mailgun-php-1.7.1.zip).**
Next, require Composer's autoloader, in your application, to automatically
load the Mailgun SDK in your project:
@@ -161,9 +141,7 @@ Go to http://bin.mailgun.net. The Postbin will generate a special URL. Save that
```php
# First, instantiate the SDK with your API credentials and define your domain.
$mg = new Mailgun('key-example', null, 'bin.mailgun.net');
$mg->setApiVersion('aecf68de');
$mg->setSslEnabled('false');
$mg = new Mailgun('key-example', 'bin.mailgun.net', 'aecf68de', $ssl = False);
$domain = 'example.com';
# Now, compose and send your message.
@@ -187,15 +165,6 @@ Batch Message is an extension of Message Builder, and allows you to easily send
a batch message job within a few seconds. The complexity of
batch messaging is eliminated!
Framework integration
---------------------
If you are using a framework you might consider these composer packages to make the framework integration easier.
* [tehplague/swiftmailer-mailgun-bundle](https://github.com/tehplague/swiftmailer-mailgun-bundle) for Symfony2
* [Bogardo/Mailgun](https://github.com/Bogardo/Mailgun) for Laravel 4
* [katanyoo/yii2-mailgun-mailer](https://github.com/katanyoo/yii2-mailgun-mailer) for Yii2
Support and Feedback
--------------------