paravibe/salesforce-wrapper

PHP 的 Salesforce API 包装器

1.1.4 2024-07-09 06:26 UTC

This package is auto-updated.

Last update: 2024-09-09 06:53:43 UTC


README

Total Downloads

安装

composer require paravibe/salesforce-wrapper

如何使用

初始化客户端

$client = new \Salesforce\Client($accessToken, $instanceUrl, $api);

其中 $accessToken 是在授权过程中获取的令牌 - https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_authentication.htm
$instanceUrl 是在授权过程中返回的字符串
$api 是要使用的 API 版本。例如 v46.0

然后,您可以通过传递到 createRequest 中来使用 Salesforce 支持的任何方法

GET/DELETE 方法

$request = $client->createRequest('GET', 'sobjects');
$response = $request->execute()->getDecodedBody();

POST/PATCH 方法

$request = $client->createRequest('POST', 'sobjects/SOME_OBJECT');
$request->attachBody(array('field' => 'value'));
$response = $request->execute()->getDecodedBody();