vansteen / laravel-sendinblue
一个用于SendinBlue API v3官方PHP库的Laravel 5/6/7/8服务提供者、外观和配置文件。
v1.4
2020-10-01 13:12 UTC
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
该包简单地提供了一个Laravel服务提供者、外观和配置文件,用于SendinBlue的API v3官方PHP库。https://github.com/sendinblue/APIv3-php-library
安装
您可以通过Composer使用以下命令安装此包
composer require vansteen/laravel-sendinblue
对于Laravel <5.5,您还必须将服务提供者和外观安装到您的config/app.php
// config/app.php 'providers' => [ ... Vansteen\Sendinblue\SendinblueServiceProvider::class, ... ];
// config/app.php 'aliases' => [ ... 'Sendinblue' => Vansteen\Sendinblue\Facades\Sendinblue::class, ];
配置
您需要将配置文件发布到app/config/sendinblue.php。要这样做,请运行
php artisan vendor:publish --tag=sendinblue.config
现在您需要使用环境变量来设置您的配置。前往Sendinblue API设置,并将v3 API密钥添加到您的.env文件中。
SENDINBLUE_APIKEY=xkeysib-XXXXXXXXXXXXXXXXXXX
使用方法
为了测试它,您可以在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; } });
要了解API端点的概念,请访问API的readme文件。
请务必访问SendinBlue官方文档网站以获取有关我们API的更多信息。
变更日志
请参阅changelog以获取有关最近更改的更多信息。
测试
composer test
贡献
请参阅contributing.md以获取详细信息以及待办事项清单。
安全性
如果您发现任何与安全性相关的问题,请通过电子邮件联系作者,而不是使用问题跟踪器。
许可证
许可证。请参阅许可证文件以获取更多信息。