Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eldadfux/mailgun-php-lite

A lite and minimalistic PHP library for sending mails using Mailgun API.
https://github.com/eldadfux/mailgun-php-lite

mailgun php

Last synced: 5 days ago
JSON representation

A lite and minimalistic PHP library for sending mails using Mailgun API.

Awesome Lists containing this project

README

        

# Mailgun PHP Lite

Mailgun PHP Lite is a lite and minimalistic PHP client library for sending mails using Mailgun API with no external dependencies.
This library was created to provide a very simple curl abstraction for sending mails using the Mailgun HTTP API.
This is an alternative to those who need to just send simple mails and think the original PHP Client is to heavy for them and have a to much dependencies.

## Installation

```bash
composer require 'eldadfux/mailgun-lite:1.3.*'
```

## Example

```php
$apiKey = 'your-api-key-here';
$apiDomain = 'your-api-sending-domain-here';

$mailgun = new \MailgunLite\MailgunLite($apiKey, $apiDomain);

$mailgun
->setFrom('[email protected]', 'Team Example')
->setReplyTo('[email protected]') // (optional)
->setSchedule(strtotime('next Thursday')) // unix time stamp (optional)
->addRecipient('[email protected]', 'User 1 Name')
->addRecipient('[email protected]', 'User 2 Name')
->addRecipient('[email protected]', 'User 3 Name')
->setSubject('Hello World')
->setText('I am a string')
->setHTML('I am a string')
;

// Send Mail
if(!$mailgun->send()) {
throw new Exception('Problem sending mail: ' . $mailgun->getError());
}

// Subscribe to newsletter
$mailgun->subscribe('[email protected]', '[email protected]');

```

## Contributing

All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.

Fork the project, create a feature branch, and send us a pull request.

### Versioning

For transparency and insight into our release cycle, and for striving to maintain backward compatibility, This project will be maintained under the Semantic Versioning guidelines as much as possible. Releases will be numbered with the following format:

`..`

For more information on SemVer, please visit [http://semver.org/](http://semver.org/).

## Requirements

PHP 7+

We recommend using the latest PHP version whenever possible.

## Author

**Eldad A. Fux**

+ [https://twitter.com/eldadfux](https://twitter.com/eldadfux)
+ [https://github.com/eldadfux](https://github.com/eldadfux)

## License

This project is licensed under the MIT License - see the LICENSE file for details