Search by

setechsolutions / eloquent-sales-force

SETechSolutions

Work with Salesforce objects as Eloquent models: an Eloquent driver for SOQL and the Salesforce REST API.

Package info

github.com/SETechSolutions/eloquent-sales-force

Documentation

pkg:composer/setechsolutions/eloquent-sales-force

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

v3.0.1 2026-10-13 22:02 UTC

This package is auto-updated.

Last update: 2026-10-13 23:08:56 UTC


README

Eloquent Salesforce

Tests Latest Stable Version License

Eloquent Salesforce

Work with Salesforce objects the way you work with Eloquent models: query, create, update, delete and relate them with the API you already know. The package translates Eloquent queries to SOQL and talks to the Salesforce REST API for you.

$leads = Lead::where('Company', 'Acme')->orderBy('LastName')->limit(20)->get();

$lead = Lead::create(['LastName' => 'Lovelace', 'Company' => 'Analytical Engines']);

$lead->update(['Status' => 'Working - Contacted']);

$account->contacts()->where('Email', 'like', '%@example.com')->get();

This is the maintained continuation of roblesterjr04/EloquentSalesForce by Rob Lester, which stopped at Laravel 11. Version 3 supports Laravel 12 and 13 and can replace rob-lester-jr04/eloquent-sales-force without code changes: the original class names keep working.

Requirements

Package version Laravel PHP
3.x 12, 13 8.2+ (8.3+ for Laravel 13)

For Laravel 11 and older, use the original package.

Installation

composer require setechsolutions/eloquent-sales-force

A fresh Laravel 13 application ships with Guzzle 8, while the Salesforce client this package builds on still needs Guzzle 7. If Composer reports a conflict on guzzlehttp/guzzle, add -W so it may switch to Guzzle 7, which Laravel 13 supports as well:

composer require setechsolutions/eloquent-sales-force -W

Add your connected app's credentials to .env:

SF_CONSUMER_KEY=
SF_CONSUMER_SECRET=
SF_USERNAME=
SF_PASSWORD=
SF_LOGIN_URL=https://login.salesforce.com

Then create a model:

php artisan make:salesforce Lead
namespace App\Models;

use SETechSolutions\EloquentSalesForce\Model;

class Lead extends Model
{
    public $columns = ['Id', 'FirstName', 'LastName', 'Email', 'Company'];
}

Coming from the original package

composer remove rob-lester-jr04/eloquent-sales-force
composer require setechsolutions/eloquent-sales-force -W

Your code keeps working: the Lester\EloquentSalesForce\* class names, the eloquent_sf config file, the SObjects facade and a soql connection in config/database.php are all still supported.

Worth knowing before you deploy:

  • Values in queries are now escaped for you, so stop escaping quotes yourself.
  • Date comparisons use true UTC and only accept dates.
  • The sync webhook requires SF_SYNC_SECRET.

Everything that is new or changed is on one page: New in version 3+. Step-by-step details are in UPGRADE.md.

Documentation

The full guide is at setechsolutions.github.io/eloquent-sales-force, and in docs/README.md.

Testing your application

Swap Salesforce for an in-memory fake, stub what queries return, and assert on what was written:

use SETechSolutions\EloquentSalesForce\Facades\SObjects;

$salesforce = SObjects::fake([
    'Lead' => [['Id' => '00Q000000000001AAA', 'Company' => 'Acme']],
]);

$this->post('/leads/00Q000000000001AAA/qualify');

$salesforce->assertUpdated('Lead', '00Q000000000001AAA', ['Status' => 'Qualified']);

Contributing

Bug reports and pull requests are welcome. See CONTRIBUTING.md. The test suite runs offline, so you do not need a Salesforce org to contribute.

Security

Please report vulnerabilities privately; see SECURITY.md.

Credits

License

MIT. See LICENSE.