quartzy / courier
A transactional email sending library using the php-email domain
Installs: 20 361
Dependents: 4
Suggesters: 0
Security: 0
Stars: 24
Watchers: 12
Forks: 0
Open Issues: 2
Requires
- php: ^7.1
- psr/log: ^1.0
- quartzy/php-email: ^0.6.0
Requires (Dev)
- phpunit/phpunit: ^7.0
- zbateson/mail-mime-parser: ^1.1
Suggests
- camuthig/courier-postmark: To deliver emails using Postmark
- camuthig/courier-sendgrid: To deliver emails using SendGrid
- quartzy/courier-sparkpost: To deliver emails using Sparkpost
README
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.