stidges/laravel-sparkpost-transport

Sparkpost transport for Laravel
35,774
Install
composer require stidges/laravel-sparkpost-transport
Latest Version:v3.0.2
PHP:^8.2
Laravel:11 · 12 · 13
Older releases:9 · 10
License:MIT
Last Updated:Apr 17, 2026
Links: GitHub  ·  Packagist
Maintainer: stidges

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.

Related Packages

vemcogroup/laravel-sparkpost-driver

SparkPost driver to use with Laravel 6.x|7.x|8.x|9.x|10.x

1,894,119 42
clarification/sendgrid-laravel-driver

Sendgrid mail driver for Laravel

31,443 11
coconutcraig/laravel-postmark

Laravel package for sending mail via the Postmark API

3,712,626 218
zalazdi/laravel-imap

Laravel 5 IMAP client.

12,910 49
eventhomes/laravel-mandrillhooks

A simple Mandrill webhook controller to help with events. Compatible with Larave...

75,648 62

Version History

Version Released PHP Laravel License
v3.0.2 ^8.2 ^11.0|^12.0|^13.0 MIT
v3.0.1 ^8.2 ^11.0|^12.0 MIT
v3.0.0 ^8.2 ^11.0 MIT
v2.0.0 ^8.1 ^10.0 MIT
v1.0.0 ^8.0 ^9.0 MIT