quartzy/courier

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

A transactional email sending library using the php-email domain

0.7.0 2019-03-12 01:53 UTC

This package is auto-updated.

Last update: 2022-09-12 09:30:28 UTC


README

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

Courier is a library to send transactional emails using domain objects and concise interfaces.

See full documentation for more details.

Courier provides an interface to sending standardized emails using third-party SaaS SMTP providers, like SparkPost and Postmark. By leveraging a standardized domain model for defining emails, Courier is capable of defining drivers (or "couriers" in our case) that allow the developer to easily switch how the provider sending their emails without changing any part of their code that builds the email.

Install

Via Composer

composer require quartzy/courier

Usage

Each email provider will also have their own courier dependency:

# Send emails with Sparkpost
composer require quartzy/courier-sparkpost

Now you just need to create an email and send it:

<?php

use Courier\Sparkpost\SparkpostCourier;
use GuzzleHttp\Client;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
use PhpEmail\EmailBuilder;
use PhpEmail\Content\SimpleContent;
use SparkPost\SparkPost;

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

$email = EmailBuilder::email()
    ->withSubject('Welcome!')
    ->withContent(SimpleContent::text('Start your free trial now!!!'))
    ->from('me@test.com')
    ->to('you@yourbusiness.com')
    ->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.