aztech / coyote
Email and SMS abstraction layer
0.1.1
2015-02-12 10:16 UTC
Requires
- php: >=5.4
- psr/log: ~1.0
Requires (Dev)
- aztech/phinject: 0.2.*
- mailgun/mailgun-php: ~1.7
- mandrill/mandrill: ~1.0
- phpunit/phpunit: ~4.1
- squizlabs/php_codesniffer: ~2
- twilio/sdk: ~3.12
- vektah/bugfree-dangerzone: 0.3.*
- videlalvaro/php-amqplib: ~2
Suggests
- mailgun/mailgun-php: To send emails using Mailgun (>= 1.7, < 2.0)
- mandrill/mandrill: To send emails using Mandrill (>= 1.0, < 2.0)
- twilio/sdk: To send text messages (SMS) using Twilio (>= 3.12, < 4.0)
- videlalvaro/php-amqplib: To publish to a RabbitMQ message queue (>= 2.0, < 3.0)
README
Coyote is a library to send emails and text messages with support for multiple provides
Setup
Install the library
Composer is the only supported way of installing Coyote. From the root of your project, run the following command:
composer require aztech/coyote
Pick a provider
Coyote is only an abstraction layer on top of existing SDK's, and by default, does not include those in order to avoid loading too many packages in your project.
Here's the list of the required packages to be able to use each provider:
For email
- Mandrill:
composer require mandrill/mandrill:~1.0
- Mailgun:
composer require mailgun/mailgun:~1.7
For text messages
- Twilio:
composer require twilio/sdk:~3.12
Features
- Send transactional emails
- Build messages using local or remote (ie. Mandrill/Mailchimp templates) message templates
- Send text messages
- Optional integration with Phinject DI container
Usage
Send emails
use \Aztech\Coyote\Email\Address; use \Aztech\Coyote\Email\Message; use \Aztech\Coyote\Email\Provider\MailgunFactory; require_once 'vendor/autoload.php'; $factory = new MailgunFactory(); $provider = $factory->buildProvider([ 'key' => 'MAILGUN_APIKEY', 'domain' => 'mydomain.com' ]); $message = new \Aztech\Coyote\Email\Message(); $message->addRecipient(new Address('email@domain.com'); $message->setTitle('News'); $message->setBody('Hello, how are you ?'); $provider->send($message);