Download the PHP package cnsdose/salesforce-php without Composer
On this page you can find all versions of the php package cnsdose/salesforce-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package salesforce-php
Salesforce PHP SDK
Installation
composer require cnsdose/salesforce-php
-
Register service provider
-
Laravel
-
Lumen
-
Others
Laravel/Lumen is optional, as long as you can provide a
config($key, $default)
function, e.g.
-
php artisan vendor:publish --provider='CNSDose\Salesforce\Providers\SalesforceProvider'
Configuration
See config/salesforce.php
.
Records API (REST API)
Query Records
The query builder only supports a small subset of SOQL clauses currently.
Basic Usage
NOTE: salesforce-php
does not support automatic quoting/escaping yet.
Resolving Relationships
Nested Query
Raw Query
Query by ID
This method retrieves all defined fields in Salesforce, even if they are not specified in the corresponding class or config/salesfore.php
.
Create/Update/Delete Records
Create a record
Upsert/Delete a record
Conversion Rules
Conversion rules allows attributes to be automatically converted/formatted.
Built-In Rules
Built-in rules are registered at \CNSDose\Salesforce\Support\Conversion\BaseConversion::$conversions
.
Some rules allow parameters, e.g. number:16,2
mean 16 digits to the left of decimal point and 2 to the right.
Custom Rules
- Create a class which is derived from
\CNSDose\Salesforce\Support\Conversion\BaseConversion
- Implement required methods
doDecode
: post-processes data after downloaded from APIdoEncode
: pre-process data before uploaded to API
- Register rule via
\CNSDose\Salesforce\Support\Conversion\BaseConversion::registerRule
- Rule parameters: format
rule_name:arg1,arg2
can be used to pass arguments to the corresponding class constructor, an example could be\CNSDose\Salesforce\Support\Conversion\Number
Custom Fields
Custom fields can be defined in config/salesforce.php
. Custom fields take precedence over default fields in case of conflicts between names.
Example
Adding 3 custom fields, with conversion rules where applicable, to object Custom
Custom Objects
Models can be automatically generated for custom objects that have been defined in Salesforce via Artisan command salesforce:generate-record-model
.
Example
Custom Type-Rule Mapping
One could use \CNSDose\Salesforce\Console\GenerateRecordModel::addTypeRule
to map a Salesforce type to a PHP type/conversion rule for convenience.
Common mappings are already defined in GenerateRecordModel
.
Metadata API (SOAP API)
Create/Read/Rename/Update/Upsert/Delete
How to use a different version of Salesforce APIs
- In Salesforce Lightning Experience, download Metadata WSDL from Setup | Integrations | API and save it in your project
- Update
api_version
andmetadata_wsdl
in configuration file - Use commands
salesforce:generate-metadata-model
andsalesforce:generate-record-model
to generate models (update_models.sh
in this library could be a good start)
All versions of salesforce-php with dependencies
ext-json Version *
ext-soap Version *
ext-xmlreader Version *
guzzlehttp/guzzle Version ^6.3
firebase/php-jwt Version ^5.0
myclabs/php-enum Version ^1.6