vansteen / laravel-sendinblue
A Laravel 5/6/7/8 service provider, facade and config file for the SendinBlue's API v3 official PHP library.
Installs: 98 276
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 1
Forks: 8
Open Issues: 4
Requires
- illuminate/support: ~5|^6.0|^7.0|^8.0
- sendinblue/api-v3-sdk: ^6.1|^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- orchestra/testbench: ~3.0|^4.0|^5.0
- php-coveralls/php-coveralls: ^2.2
- phpunit/phpunit: ~5.7|^8.0|^9.0
README
The package simply provides a Laravel service provider, facade and config file for the SendinBlue's API v3 official PHP library. https://github.com/sendinblue/APIv3-php-library
Installation
You can install this package via Composer using:
composer require vansteen/laravel-sendinblue
For Laravel <5.5, you must also install the service provider and the facade to your config/app.php
:
// config/app.php 'providers' => [ ... Vansteen\Sendinblue\SendinblueServiceProvider::class, ... ];
// config/app.php 'aliases' => [ ... 'Sendinblue' => Vansteen\Sendinblue\Facades\Sendinblue::class, ];
Configuration
You need to publish the config file to app/config/sendinblue.php
. To do so, run:
php artisan vendor:publish --tag=sendinblue.config
Now you need to set your configuration using environment variables.
Go the the Sendinblue API settings and add the v3 API key to your .env
file.
SENDINBLUE_APIKEY=xkeysib-XXXXXXXXXXXXXXXXXXX
Usage
To test it, you can add the folowing code in routes.php.
// routes.php ... use Vansteen\Sendinblue\Facades\Sendinblue; Route::get('/test', function () { // Configure API keys authorization according to the config file $config = Sendinblue::getConfiguration(); // Uncomment below to setup prefix (e.g. Bearer) for API keys, if needed // $config->setApiKeyPrefix('api-key', 'Bearer'); // $config->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new \SendinBlue\Client\Api\ListsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); try { $result = $apiInstance->getLists(); dd($result); } catch (Exception $e) { echo 'Exception when calling AccountApi->getAccount: ', $e->getMessage(), PHP_EOL; } });
To get a idea of the of the API endpoints, visit the API readme file.
Be sure to visit the SendinBlue official documentation website for additional information about our API.
Change log
Please see the changelog for more information on what has changed recently.
Testing
composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
License
license. Please see the license file for more information.