1. Go to this page and download the library: Download antogkou/laravel-salesforce 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/ */
antogkou / laravel-salesforce example snippets
use Antogkou\LaravelSalesforce\Facades\Salesforce;
// Basic request
$response = Salesforce::get('/endpoint');
// With custom user context
$response = Salesforce::setEmail('[email protected]')
->get('/endpoint');
// With custom headers
$response = Salesforce::post('/endpoint', $data, [
'Custom-Header' => 'Value'
]);
// Set custom user email for the request
$response = Salesforce::setEmail('[email protected]')
->get('/endpoint');
// With query parameters
$response = Salesforce::get('/endpoint', [
'limit' => 10,
'offset' => 0
]);
// With custom headers
$response = Salesforce::post('/endpoint', $data, [
'Custom-Header' => 'Value'
]);
// Handling responses
$response = Salesforce::get('/endpoint');
if ($response->successful()) {
$data = $response->json();
$status = $response->status();
} else {
$error = $response->json('error');
}