sendinblue/api-bundle

此包已被弃用且不再维护。未建议替代包。

sendinblue/api-v3-sdk 的 Symfony 扩展包

安装次数: 237,006

依赖项: 0

建议者: 0

安全: 0

星标: 15

关注者: 6

分支: 9

开放问题: 0

类型:symfony-bundle

1.4.0 2018-03-23 13:00 UTC

This package is not auto-updated.

Last update: 2020-11-14 07:21:21 UTC


README

注意:此包已被弃用。作为替代,可以使用 sendinblue/api-v3-sdk 来集成 Sendinblue APIs

此包将在 2020 年 10 月 31 日 00:00:00 UTC 时存档。

sendinblue/api-bundle

此扩展包将 sendinblue/api-v3-sdk 集成到 Symfony。

安装

步骤 1:下载扩展包

打开命令行控制台,进入项目目录,然后执行以下命令以下载此扩展包的最新稳定版本

$ composer require sendinblue/api-bundle "~1"

此命令要求您全局安装 Composer,如 Composer 文档中的安装章节中所述。

步骤 2:启用扩展包

然后,通过将其添加到项目 app/AppKernel.php 文件中注册的扩展包列表来启用扩展包

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new SendinBlue\Bundle\ApiBundle\SendinBlueApiBundle(),
        );

        // ...
    }

    // ...
}

配置

sendinblue_api:
    endpoints: []
    key: ~

您将在 sendinblue_api.key 下定义 API 客户端密钥。

然后,您需要为要访问的端点进行 otp-in。每个端点将创建一个服务

  • 账户
  • 属性
  • 联系人
  • 电子邮件活动
  • 文件夹
  • 列表
  • 流程
  • 分销商
  • 发件人
  • 短信活动
  • SMTP
  • 事务性短信
  • Webhook

服务名称将为 sendinblue_api.%s_endpoint,其中 %s 是上面的列表中的一个值。相应的类可以在 SendinBlue\Client\Api 命名空间下找到。

/** @var SendinBlue\Client\Api\AccountApi $accountEndpoint */
$accountEndpoint = $this->get('sendinblue_api.account_endpoint');

多个客户端

要使用多个客户端,您必须将 keyendpoints 参数移动到 clients 关联数组下。每个客户端将由其密钥命名。

sendinblue_api:
    clients:
        first:
            endpoints:
                - account
            key: ~
        second:
            endpoints:
                - account
            key: ~

要访问第一个客户端的账户端点,您将获得 sendinblue_api.first_client.account_endpoint 服务。

默认客户端

您可以通过 default_client 参数定义默认客户端;默认情况下为第一个定义的客户端。您可以通过不添加其名称在服务名称中访问默认客户端端点。在上面的示例中,sendinblue_api.account_endpoint 服务将是 sendinblue_api.first_client.account_endpoint 的别名。

如果您写入

sendinblue_api:
    default_client: second
    clients:
        first:
            endpoints:
                - account
            key: ~
        second:
            endpoints:
                - account
            key: ~

那么 sendinblue_api.account_endpoint 将是 sendinblue_api.second_client.account_endpoint 的别名。