rick20/laravel-sendinblue

提供Laravel 6的service provider,facade和配置文件,用于SendinBlue的API v3官方PHP库。

v1.0.1 2019-09-09 11:51 UTC

This package is auto-updated.

Last update: 2024-09-25 18:59:54 UTC


README

Latest Version on Packagist Total Downloads Build Status Quality Score StyleCI

该包仅提供Laravel 5的service provider,facade和配置文件,用于SendinBlue的API v3官方PHP库。https://github.com/sendinblue/APIv3-php-library

安装

您可以使用Composer安装此包:

$ composer require vansteen/laravel-sendinblue

对于Laravel <5.5,您还必须在config/app.php中安装service provider和facade

// 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 --provider="Vansteen\Sendinblue\SendinblueServiceProvider"

现在您需要使用环境变量来设置配置。转到Sendinblue API设置,并将v3 API密钥添加到您的.env文件中。

SENDINBLUE_APIKEY=xkeysib-XXXXXXXXXXXXXXXXXXX

使用方法

// routes.php
...
use Vansteen\Sendinblue\Facades\Sendinblue;

Route::get('/test', function () {

    $config = Sendinblue::getConfiguration();

    $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以获取详细信息和工作清单。

安全

如果您发现任何与安全相关的问题,请通过电子邮件发送给作者,而不是使用问题跟踪器。

许可证

许可证。请参阅许可证文件以获取更多信息。