maillotf / salesforce-bridge-bundle
为Symfony设计的Salesforce包
1.0
2020-09-15 12:07 UTC
Requires
- php: ^7.0
- genesis-global/salesforce: ^1.1.9
- symfony/config: ^3.2|^4.0|^4.1
- symfony/dependency-injection: ^3.2|^4.0|^4.1
- symfony/http-kernel: ^3.2|^4.0|^4.1
Requires (Dev)
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2024-09-15 18:19:31 UTC
README
基于用户名和密码认证的Salesforce REST客户端的Symfony包
所需配置
兼容symphony 4和php7
修改framework.yaml
salesforce: authentication: endpoint: "https://login.salesforce.com/" client_id: "CLIENT_ID" client_secret: "CLIENT_SECRET" username: "USERNAME" password: "PASSWORD" security_token: 'SECURITY_TOKEN' rest: version: "v35.0" endpoint: "https://YOURINSTANCE.salesforce.com"
修改services.yaml
services: MaillotF\Salesforce\SalesforceBridgeBundle\Service\SalesforceService: '@salesforce.service'
## 使用composer安装包
$ composer require maillotf/salesforce-bridge-bundle
在控制器中使用
<?php //... use MaillotF\Salesforce\SalesforceBridgeBundle\Service\SalesforceService; class exampleController extends AbstractController { /** * Example * * @Route("example", name="example", methods={"GET"}) * */ public function test(SalesforceService $SalesforceService) { //Update record $response = $SalesforceService->getBySobjectId('Contact', '0035J000001fqm1QAA'); if ($response->isSuccess() === true) return ($this->json('OK')); return ($this->json('Not Found', Response::HTTP_BAD_REQUEST)); } }