Download the PHP package codegenus/salesforce-rest-sdk without Composer
On this page you can find all versions of the php package codegenus/salesforce-rest-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codegenus/salesforce-rest-sdk
More information about codegenus/salesforce-rest-sdk
Files in codegenus/salesforce-rest-sdk
Package salesforce-rest-sdk
Short Description An SDK for the Salesforce Rest API
License proprietary
Informations about the package salesforce-rest-sdk
Salesforce Rest SDK
This API supports the following areas of the Salesforce API:
- Limits
- Global Describe
- SObject Describe
- SObject CRUD
- SObject Get Updated/Deleted
- Composite API
- Batch
- Tree
- SObject Collections
- Bulk API
- Streaming API
Installation
Instantiate a Rest Client
For more information about using client app names with Change Data Capture, see https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_event_fields_header.htm
If you have an authorization code returned to your redirectUrl and wish to use it, you can do so like this:
Cached Auth Providers
Cached Auth Providers provide a way to hold onto valid credentials across requests, otherwise the client will authenticate with Salesforce every time it's instantiated.
Composer autoloading without a framework
If you happen to not be using a PHP Framework that handles annotation registration for you, like Symfony, then you must do it yourself:
Work with SObjects with the SObject Client
For more information on Batch Sizes and the Sforce-Query-Options header, see https://developer.salesforce.com/docs/atlas.en-us.220.0.api_rest.meta/api_rest/headers_queryoptions.htm.
It should be noted that batch size may not be respected in Salesforce if it is not optimal for performance
Instantiate the Streaming Client
Subscribe to a PushTopic
You can create a new PushTopic using the Rest Client above. The topic only needs created once in a Salesforce Org. All custom objects are supported by the Streaming API, however, not all standard objects supported.
Supported Standard Objects:
- Account
- Campaign
- Case
- Contact
- ContractLineItem
- Entitlement
- Lead
- LiveChatTranscript
- Opportunity
- Quote
- QuoteLineItem
- ServiceContract
- Task
Tasks that are created or updated using the following methods don’t appear in task object topics in the streaming API.
- Lead conversion
- Entity merge
- Mass email contacts/leads
The
$client->start();
is a blocking call and no code after it will execute until an error occurs in the client, causing it to disconnect.For instance, the client must reconnect to the streaming server within 40 seconds after each notification is received. If it fails to do so, it will attempt to re-handshake to create a new connection. If that fails, then the client will disconnect, which will allow the rest of the script to execute.
It's recommended that the streaming client be run in it's own thread
Dispatching Generic Events
Create a Streaming Channel
Before you can dispatch a Generic Event, you must create a Streaming Channel. That can be done in a number of ways:
- Via the Salesforce Classic UI as documented here
- By enabling Enable Dynamic Streaming Channel Creation under Setup > User Interface and then subscribing to a Streaming Channel using the Streaming Client as documented above
- Streaming Channels are a regular ole SObject and can be created like one:
Send Generic Events to the Streaming Channel
Once the StreamingChannel is created, events can now be sent to it using the GenericEventClient
, which piggybacks
on the SObject client. Let's pretend we're continuing the code from above in this next example:
Future Additions
- Tooling API
- Metadata API
All versions of salesforce-rest-sdk with dependencies
guzzlehttp/guzzle Version ^7.0
jms/serializer Version ^3.0
ramsey/uuid Version ^4.0
doctrine/collections Version ^1.5|^2.0
symfony/cache Version ^5.0|^6.0|^7.0
symfony/expression-language Version ^5.0|^6.0|^7.0
jms/metadata Version ^1.0|^2.0