SparkPost module for the Lumen PHP framework.
Run the following command to install the package through Composer:
composer require nordsoftware/lumen-sparkpost
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.
Add the following lines to bootstrap/app.php
:
$app->register(Nord\Lumen\SparkPost\SparkPostServiceProvider::class);
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',
]);
}
Please read the guidelines.
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
MIT, see LICENSE.