daikazu/eloquent-salesforce-objects
Laravel Eloquent-style models for Salesforce sObjects. Query and sync Salesforce data using familiar Eloquent patterns, with object mapping and relationships to work with Accounts, Contacts, and more from your Laravel app.
A Laravel package that lets you work with Salesforce objects using Eloquent syntax. Built on top of omniphx/forrest for authentication and API communication.
This package was heavily inspired by fabulous roblesterjr04/EloquentSalesForce, but written from the ground up with modern PHP 8.4+, full type safety, and a cleaner architecture. If you're migrating from that package, see the migration guide.
hasMany, belongsTo, and hasOnephp artisan make:salesforce-model scaffolds models from live Salesforce metadatacomposer require daikazu/eloquent-salesforce-objects
Configure omniphx/forrest with your Salesforce credentials, then scaffold a model:
php artisan make:salesforce-model Account
Or define one manually:
use Daikazu\EloquentSalesforceObjects\Models\SalesforceModel;
class Account extends SalesforceModel
{
protected ?array $defaultColumns = [
'Name',
'Industry',
'AnnualRevenue',
];
}
Query with familiar Eloquent syntax:
$accounts = Account::where('Industry', 'Technology')
->orderBy('Name')
->get();
$account = Account::create(['Name' => 'Acme Corp']);
$account->update(['Industry' => 'Manufacturing']);
$account->delete();
$account->contacts; // hasMany
$contact->account; // belongsTo
See the Quickstart Guide for a full walkthrough.
composer test
MIT. See LICENSE.
Need help? Check the docs or open an issue.
How can I help you explore Laravel packages today?