1. Go to this page and download the library: Download myoutdesk/salesforcerest library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
myoutdesk / salesforcerest example snippets
use MyOutDesk\SalesforceRest\SalesforceClient;
$salesforceRest = new SalesforceRest(new \GuzzleHttp\Client());
$connected = $salesforceRest->connectApp(CONSUMER_KEY, CONSUMER_SECRET)
->asUser(SALESFORCE_USER, SALESFORCE_PASSWORD)
->authenticate();
if($connected) {
// good to go
}
// Get all fields
$salesforceRest->get('Lead', ID);
// Get only specific fields
$salesforceRest->get('Lead', ID, ['Phone', 'customfield__c', 'email']);
// Requires api 42.0
$salesforceRest->getCollection('Lead', [ID, ANOTHER_ID], ['firstName', 'lastName']);