This Laravel package provides an interface for using Salesforce CRM through its SOAP API.
This package is intended to support both Laravel 6.x and 7.x
For Laravel 5.x support, see Davispeixoto's original package
The Laravel package can be installed via Composer by requiring the
toonboom/laravel-salesforce
package in your project's composer.json
.
{
"require": {
"toonboom/laravel-salesforce": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "[email protected]:toonboom/laravel-salesforce.git"
}
]
}
And running a composer update from your terminal:
php composer update
To use the Salesforce Package, you must register the provider when bootstrapping your Laravel application.
Find the providers
key in your config/app.php
and register the Service Provider (namespace is unchanged from original)
'providers' => array(
// ...
Davispeixoto\Laravel5Salesforce\SalesforceServiceProvider::class,
)
'aliases' => array(
// ...
'Salesforce' => Davispeixoto\Laravel5Salesforce\SalesforceFacade::class,
)
By default, the package uses the following environment variables to auto-configure the plugin without modification:
SALESFORCE_USERNAME
SALESFORCE_PASSWORD
SALESFORCE_TOKEN
Place your your enterprise WSDL file into your app storage/app/wsdl/
directory.
To customize the configuration file, publish the package configuration using Artisan.
php artisan vendor:publish
Update the settings in the generated config/salesforce.php
configuration file with your credentials.
return [
'username' => 'YOUR_SALESFORCE_USERNAME',
'password' => 'YOUR_SALESFORCE_PASSWORD',
'token' => 'YOUR_SALESFORCE_TOKEN',
'wsdl' => 'path/to/your/enterprise.wsdl.xml',
];
IMPORTANT: the PHP Force.com Toolkit for PHP only works with Enterprise WSDL
That's it! You're all set to go. Just use:
Use Salesforce;
Route::get('/test', function() {
try {
echo print_r(Salesforce::describeLayout('Account'), true);
} catch (Exception $e) {
echo $e->getMessage();
echo $e->getTraceAsString();
}
});
Use Salesforce;
$query = "SELECT ..., ..., ... FROM Object__c WHERE Id = '$this->id'";
$bank = Salesforce::query($query)->records;
Check out the SOAP API Salesforce Documentation
This software is licensed under the MIT license
This project follows the Semantic Versioning