Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

digiaonline/lumen-sparkpost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lumen SparkPost

Test 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' => '[email protected]',
        ],
        'recipients' => [
            [
                'address' => [
                    'email' => '[email protected]',
                ],
            ],
        ],
        '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.