Skip to content
develop
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Lumen SparkPost

Build Status Coverage Status Code Climate Scrutinizer Code Quality Latest Stable Version Total Downloads License

SparkPost module for the Lumen PHP framework.

Requirements

Setup

Installation

Run the following command to install the package through Composer:

composer require nordsoftware/lumen-sparkpost

Configure

Copy the configuration template in config/sparkpost.php to your application's config directory and modify according to your needs. For more information see the Configuration Files section in the Lumen documentation.

The only required config is the API key, which you can get on your SparkPost account pages. Please note that the default configuration uses synchronous sending mode. If you want to change that, set the async option to true instead.

Bootstrapping

Add the following lines to bootstrap/app.php:

$app->register(Nord\Lumen\SparkPost\SparkPostServiceProvider::class);

Usage

You can now use Nord\Lumen\SparkPost\SparkPostService to access SparkPost anywhere in your application.

public function sendEmail(SparkPostService $sparkpost) {
    $results = $sparkpost->send([
        'from' => [
            'name' => 'From Envelope',
            'email' => 'from@sparkpostbox.com',
        ],
        'recipients' => [
            [
                'address' => [
                    'email' => 'john.doe@example.com',
                ],
            ],
        ],
        'template' => 'my-first-email',
    ]);
}

Contributing

Please read the guidelines.

Running tests

Clone the project and install its dependencies by running:

composer install

Run the following command to run the test suite:

vendor/bin/codecept run unit

License

MIT, see LICENSE.

You can’t perform that action at this time.