quartzy/courier-sparkpost

This package is abandoned and no longer maintained. No replacement package was suggested.

An adapter to use SparkPost with Courier

0.3.0 2019-01-29 10:50 UTC

This package is auto-updated.

Last update: 2022-09-14 15:28:49 UTC


README

Latest Version on Packagist Total Downloads Software License Build Status Coverage Status Style Status Scrutinizer Code Quality

A courier implementation for SparkPost.

See documentation for full details.

Install

Via Composer

composer require quartzy/courier-sparkpost

You will also need to install a php-http implementation library as defined in the SparkPost docs.

Usage

<?php

use Courier\SparkPost\SparkPostCourier;
use GuzzleHttp\Client;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
use PhpEmail\Content\TemplatedContent;
use PhpEmail\EmailBuilder;
use SparkPost\SparkPost;

new Client();

$courier = new SparkPostCourier(
    new SparkPost(new GuzzleAdapter(new Client()), ['key'=>'YOUR_API_KEY'])
);

$email = EmailBuilder::email()
    ->from('test@mybiz.com')
    ->to('loyal.customer@email.com')
    ->replyTo('test@mybiz.com', 'Your Sales Rep')
    ->withSubject('Welcome!')
    ->withContent(new TemplatedContent('my_email', ['testKey' => 'value']))
    ->build();

$courier->deliver($email);

For details on building the email objects, see Php Email.

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email opensource@quartzy.com instead of using the issue tracker.

Credits

License

The Apache License, v2.0. Please see License File for more information.