LaravelPackages.net
Acme Inc.
Toggle sidebar
stidges/laravel-sparkpost-transport

Sparkpost transport for Laravel

33.278
0
v3.0.2
About stidges/laravel-sparkpost-transport

stidges/laravel-sparkpost-transport is a Laravel package for sparkpost transport for laravel. It currently has 0 GitHub stars and 33.278 downloads on Packagist (latest version v3.0.2). Install it with composer require stidges/laravel-sparkpost-transport. Discover more Laravel packages by stidges or browse all Laravel packages to compare alternatives.

Last updated

Sparkpost transport for Laravel 11+

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Sparkpost transport for Laravel 11+

Note: use v1 of this package for Laravel 9.x support Note: use v2 of this package for Laravel 10.x support

Installation

You can install the package via composer:

composer require stidges/laravel-sparkpost-transport

Usage

1. Configuration

To get started, update your config/services.php with your Sparkpost secret key like so:

<?php

return [
    // ...
    'sparkpost' => [
        'secret' => env('SPARKPOST_SECRET'),
    ],
];

Next, add the Sparkpost transport to the mailers section of your config/mail.php:

<?php

return [
    // ...
    'mailers' => [
        // ...
        'sparkpost' => [
            'transport' => 'sparkpost',
        ],
    ],
    // ...
];

And finally, update your .env file to add the SPARKPOST_SECRET and to update the MAIL_MAILER:

MAIL_MAILER=sparkpost

SPARKPOST_SECRET=YourSecretKey

2. Customizing the Sparkpost API domain

If you'd like to use the EU domain for Sparkpost, you can add the domain to your config/services.php file:

'sparkpost' => [
    'secret' => env('SPARKPOST_SECRET'),
    'domain' => 'api.eu.sparkpost.com',
],

3. Customizing Sparkpost Transmission API options

You can add a options array to your config/services.php to add any data you would like to send to the Sparkpost API. Any data in the options array will be merged into the API request body. For details on how you can customize the transmission, review the Sparkpost API documentation

'sparkpost' => [
    'secret' => env('SPARKPOST_SECRET'),
    'options' => [
        'campaign_id' => 'my_campaign_id',
        'options' => [
            'click_tracking' => false,
        ],
    ],
],

4. Customizing the Guzzle client

You can add any options to the Guzzle client by adding a guzzle array to your config/services.php file:

'sparkpost' => [
    'secret' => env('SPARKPOST_SECRET'),
    'guzzle' => [
        'timeout' => 10,
    ],
],

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments