⚠️ WORK IN PROGRESSThis package is currently under active development and should be considered alpha/beta quality. While it is functional and tested, the API may change, and there may be undiscovered bugs.
Use at your own risk in production environments. We recommend thorough testing in development/staging environments before deploying to production. Please report any issues you encounter!
Eloquent Salesforce Objects is a powerful Laravel package built on top of the excellent omniphx/forrest package. It provides an Eloquent-style interface for working with Salesforce objects, allowing you to define Salesforce models just like Eloquent models and interact with your Salesforce data using familiar Laravel conventions.
- Eloquent-Style Models - Define Salesforce objects using familiar Laravel model syntax
- CRUD Operations - Create, read, update, and delete Salesforce records
- Relationships - Support for
hasMany,belongsTo, andhasOnerelationships - Aggregate Functions - COUNT, SUM, AVG, MIN, MAX support
- Pagination - Built-in pagination with Laravel's paginator
- Bulk Operations - Efficient bulk insert, update, and delete operations
- Automatic Authentication - Seamless OAuth token management via omniphx/forrest
- Field Mapping - Automatic conversion between Laravel and Salesforce naming conventions (optional)
- PHP 8.4 or higher
- Laravel 12.0 or higher
- Salesforce Account with API access enabled
- omniphx/forrest - Salesforce REST API client (installed automatically as a dependency)
composer require daikazu/eloquent-salesforce-objectsBefore using this package, you must configure the omniphx/forrest package, which handles Salesforce authentication and API communication.
-
Publish the Forrest configuration:
php artisan vendor:publish --provider="Omniphx\Forrest\Providers\Laravel\ForrestServiceProvider" -
Configure your Salesforce credentials in
config/forrest.phpand.env -
See the Forrest documentation for detailed setup instructions
-
Optionally publish this package's configuration:
php artisan vendor:publish --tag="eloquent-salesforce-objects-config"
For complete setup instructions, see our Installation Guide.
Define a Salesforce model and query data using familiar Eloquent syntax:
use Daikazu\EloquentSalesforceObjects\Models\SalesforceModel;
class Account extends SalesforceModel
{
protected $table = 'Account';
protected $fillable = ['Name', 'Industry', 'AnnualRevenue'];
}
// Query with familiar Eloquent syntax
$accounts = Account::where('Industry', 'Technology')
->orderBy('Name')
->get();
// Create, update, delete
$account = Account::create(['Name' => 'Acme Corp']);
$account->update(['Industry' => 'Manufacturing']);
$account->delete();
// Relationships
$account->contacts; // hasMany
$contact->account; // belongsToCheck out the Quickstart Guide for detailed examples and step-by-step instructions.
For detailed installation and configuration instructions, see:
- Installation Guide - Complete setup walkthrough
- Configuration Reference - All configuration options
- omniphx/forrest Documentation - Salesforce API client setup
- Installation Guide - Detailed installation and setup instructions
- Configuration - Configure Salesforce connection and package options
- Quickstart Guide - Get up and running in 5 minutes
- Models - Creating and configuring Salesforce models
- Querying Data - Building SOQL queries with the query builder
- CRUD Operations - Creating, reading, updating, and deleting records
- Relationships - Defining and using relationships between objects
- Working with Timestamps - Using Carbon for date manipulation with
diffForHumans()and more
- Bulk Operations - Efficient bulk insert, update, and delete
- Custom Apex REST Endpoints - Call custom Apex REST endpoints
- Aggregate Functions - Using COUNT, SUM, AVG, MIN, MAX
- Pagination - Paginating large result sets
- Configuration Reference - All configuration options explained
- Troubleshooting - Common issues and solutions
Run the test suite:
composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.
Need help? Check out the documentation or open an issue.