davispeixoto / Laravel-5-Salesforce by davispeixoto

Laravel 5 Salesforce Force.com PHP Toolkit port
137,945
47
7
Package Data
Maintainer Username: davispeixoto
Maintainer Contact: davis.peixoto@gmail.com (Davis Peixoto)
Package Create Date: 2015-04-27
Package Last Update: 2022-12-28
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-30 15:25:58
Package Statistics
Total Downloads: 137,945
Monthly Downloads: 460
Daily Downloads: 4
Total Stars: 47
Total Watchers: 7
Total Forks: 36
Total Open Issues: 0

Laravel 5 Salesforce

This Laravel 5 package provides an interface for using Salesforce CRM through its SOAP API.

(Laravel 4 Salesforce Package can be found here)

Latest Stable Version Total Downloads Scrutinizer Code Quality Codacy Badge Code Climate Build Status SensioLabsInsight

Major upgrade

This package is intended to support both Laravel 5.1 LTS and 5.2+.

Laravel 5.1 package will be kept under version 1.* Laravel 5.2 package will be kept under version 2.*

Consider this when installing or upgrading

It also fixes a too much consuming session at Salesforce, thus these new versions needs adding the section aliases under config/app.php

Installation

The Laravel 5 package can be installed via Composer by requiring the davispeixoto/laravel5-salesforce package in your project's composer.json.

{
    "require": {
        "davispeixoto/laravel5-salesforce": "~1.0"
    }
}

And running a composer update from your terminal:

php composer.phar update

To use the Salesforce Package, you must register the provider when bootstrapping your Laravel 5 application.

Find the providers key in your config/app.php and register the AWS Service Provider.

    'providers' => array(
        // ...
        Davispeixoto\Laravel5Salesforce\SalesforceServiceProvider::class,
    )
    
    'aliases' => array(
        // ...
        'Salesforce' => Davispeixoto\Laravel5Salesforce\SalesforceFacade::class,
    )

Configuration

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

Usage

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();
        }
    });

More Information

Check out the SOAP API Salesforce Documentation

License

This software is licensed under the MIT license

Versioning

This project follows the Semantic Versioning

Thanks

An amazing "Thank you, guys!" for Jetbrains folks, who kindly empower this project with a free open-source license for PhpStorm which can bring a whole new level of joy for coding.

Jetbrains

PhpStorm