nordsoftware / lumen-sparkpost
SparkPost module for the Lumen PHP framework.
Installs: 6 484
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 12
Forks: 1
Open Issues: 0
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: ^6.2
- php-http/guzzle6-adapter: ^1.1
- sparkpost/sparkpost: ^2.1
Requires (Dev)
- codeception/codeception: ^2.1
- codeception/specify: ^0.4.3
- codeception/verify: ^0.3.0
- laravel/lumen-framework: ^5.1
README
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.