proglab / selligent-client-bundle
Selligent 客户端包
v6.1.0
2022-09-05 14:22 UTC
Requires
- php: >=8.1
- ext-soap: *
- symfony/framework-bundle: ^6.1
- symfony/http-kernel: ^6.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0.0
- phpstan/phpstan: ^0.12.88
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-master
- symfony/phpunit-bridge: ^5.3
- symfony/test-pack: ^1.0
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
您有两种选择
- 手动创建客户端,并传入一个记录器
use Proglab\SelligentClientBundle\Service\SelligentClient; use Psr\Log\NullLogger; $logger = new NullLogger(); $client = new SelligentClient($logger);
- 从依赖注入中获取客户端
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);