bharatk / mailgunserviceprovider
Mailgun Service Provider for Silex
1.1.0
2023-01-05 04:41 UTC
Requires
- php: >=7.1.3
- kriswallsmith/buzz: ^1.2
- mailgun/mailgun-php: ^3.2
- nyholm/psr7: ^1.5
- pimple/pimple: ^1.0
- silex/silex: ^1.1
This package is not auto-updated.
Last update: 2025-03-14 13:12:44 UTC
README
A Simple wrapper for the mailgun API for the Silex Framework.
Features
- Easy setup.
- All the Mailgun API features.
Requirements
- PHP 5.3+
- mailgun-php
Installation
$ composer require bharatk/mailgunserviceprovider
Setup
require_once __DIR__.'/vendor/autoload.php';
use Silex\Application;
use AchrafSoltani\Provider\MailgunServiceProvider;
$app = new Application();
$app->register(new MailgunServiceProvider(), array(
'mailgun.api_key' => 'key-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'mailgun.domain' => 'domain.tld',
));
// Usage
$app->run();
Usage
- Example 1 : Sending an email
$message = array(
'from' => 'Excited User <name@domain.tld>',
'to' => 'Baz <foo.bar@example.com>',
'subject' => 'Greetings!',
'text' => 'Testing some Mailgun awesomness!'
);
$app['mailgun']->sendMessage($message);
- Example 2 : Creating a mailing list through the API
$app['mailgun']->post("lists", array(
'address' => 'LIST@domain.tld',
'description' => 'Mailgun Dev List'
));
Full API documentation
Check how to use the full API capabilities at https://documentation.mailgun.com/user_manual.html