portospire/suitecrmclient

一个用于与 SuiteCRM 一起使用的免费客户端库,用于抽象各种 API 使用,以实现更简单的集成。由 PortoSpire 提供

0.1.3.3 2024-03-02 16:20 UTC

This package is auto-updated.

Last update: 2024-08-31 00:35:49 UTC


README

SuiteCRM API Client

Version Size License

用于 SuiteCRM 的客户端库

一个用于 SuiteCRM 的免费(LGPL3)客户端库,用于抽象各种 API 使用,以实现更简单的集成。

由 PortoSpire 提供
PortoSpire - be seen

目录

1. 简介
2. 设置
3. 使用
3.1. Mezzio
3.2. Laminas MVC
3.3. 独立使用

简介

此包提供 SuiteCRM 客户端以抽象 API 调用和表单提交,以便从 SuiteCRM 实例提供和接收数据。它根据需要使用 Person Form 营销活动和 V8 及 rest API。

设置

将其添加到项目的 composer.json 中

composer require portospire/suitecrmclient

使用

此包旨在支持 Laminas Mezzio 和 Laminas MVC,并且可以作为独立库使用。

从 SuiteCRM 实例获取 Web 营销活动列表的示例

$SuiteCRMClient->setServerDomain($server_domain);
$SuiteCRMClient->setClientId($client_id);
$SuiteCRMClient->setClientSecret($client_secret);
$filter = new \PortoSpire\SuiteCRMClient\Model\Filter(['campaign_type' => 'Web']);
$json = $SuiteCRMClient->getCampaigns([], ['size' => 20, 'number' => 1], 'name', $filter); // this will contain json of the results
$campaignsFull = $SuiteCRMClient->convertJsonToGenerics($json); // this converts the json to PHP objects

将潜在客户提交到 SuiteCRM 实例中的 web-to-lead 表单的示例:(如果您有自定义字段,可以扩展提供的模型(Model/WebToLead 等))

$values = (array) $WebToLead; // expects an array of key=>value pairs where the keys match the different fields from the web-to-lead form
$SuiteCRMClient->setServerDomain($server_domain);
$SuiteCRMClient->setClientId($client_id);
$SuiteCRMClient->setClientSecret($client_secret);
$SuiteCRMClient->submitWebToLead($values, $campaign_id); // this must match the campaign id that the web-to-lead form is associated to in SuiteCRM

Mezzio

将 ConfigProvider 类添加到配置聚合器(通常位于 config/config.php)

$aggregator = new ConfigAggregator([
...
\PortoSpire\SuiteCRMClient\ConfigProvider::class,
...

然后根据您的用例在处理器/中间件中需要时使用客户端。

Laminas MVC

要开始使用 Laminas MVC 与库一起使用,除了将其添加到项目的 composer.json 中外,不需要采取任何其他步骤。

独立使用

要开始使用库,除了将其添加到项目的 composer.json 中外,不需要采取任何其他步骤。