proglab/selligent-client-bundle

Selligent 客户端包

安装数量: 1,238

依赖项: 0

建议者: 0

安全性: 0

星标: 1

关注者: 4

分支: 0

公开问题: 0

类型:symfony-bundle

v6.1.0 2022-09-05 14:22 UTC

This package is auto-updated.

Last update: 2024-09-05 18:26:03 UTC


README

Selligent 基本客户端

安装

您必须将此内容添加到您的 .env 文件中

###> proglab/selligent-client-bundle ###
APISELLIGENTCLIENT_INDIVIDUAL_URL=xxx
APISELLIGENTCLIENT_BROADCAST_URL=xxx
APISELLIGENTCLIENT_LOGIN=xxx
APISELLIGENTCLIENT_PASSWORD=xxx
###< proglab/selligent-client-bundle ###

打开命令行,进入您的项目目录并执行

composer require proglab/selligent-client-bundle

如果您不使用 symfony/flex,请通过将包添加到项目中注册的包列表来启用该包,在您的项目的 config/bundles.php 文件中

// config/bundles.php

return [
    // ...
    Proglab\SelligentClientBundle\SelligentClientBundle::class => ['all' => true],
];

用法

一般

获取 SelligentClient

您有两种选择

  1. 手动创建客户端,并传入一个记录器
use Proglab\SelligentClientBundle\Service\SelligentClient;
use Psr\Log\NullLogger;

$logger = new NullLogger();
$client = new SelligentClient($logger);
  1. 从依赖注入中获取客户端
use Proglab\SelligentClientBundle\Service\SelligentClient;

class Service
{
    public function __construct(private SelligentClient $client)
    {
    }
}

连接

您必须连接到 Selligent SOAP API。

您需要 individual_url、broadcast_url、login 和 password。

$client->connect('individual_url', 'broadcast_url', 'login', 'password');

获取记录

通过过滤器获取记录

$filters = ['ID' => 18];
$listId = 54;
$client->getOneByFilter($filters, $listId);

创建行

在列表中创建记录

$data = [
    'MAIL' => 'xx@xxxxx.xxx',
    'NAME' => 'xxxxx xxxx',
    'LANGUAGE' => 'fr'
];
$listId = 54;
$client->createRow($data, $listId);

更新行

在列表中更新记录

$data = ['FIRSTNAME' => 'Fabrice'];
$listId = 54;
$client->updateRow($data, 54, $listId);