PHPackages                             flinty916/laravel-salesforce - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. flinty916/laravel-salesforce

ActiveLibrary[API Development](/categories/api)

flinty916/laravel-salesforce
============================

Salesforce Integration package for the Laravel framework

v1.1.8(7mo ago)928MITPHP

Since Aug 12Pushed 7mo agoCompare

[ Source](https://github.com/Flinty916/laravel-salesforce)[ Packagist](https://packagist.org/packages/flinty916/laravel-salesforce)[ RSS](/packages/flinty916-laravel-salesforce/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (15)Used By (0)

Laravel Salesforce
==================

[](#laravel-salesforce)

This package provides a streamlined way to integrate Salesforce objects into your Laravel application.
It includes a custom query builder, model base class, and an Artisan command to automatically generate strongly-typed PHP classes for your Salesforce SObjects.

Installation
------------

[](#installation)

Install via Composer:

```
composer require flinty916/laravel-salesforce
```

### Environment Variables

[](#environment-variables)

Before using the package, you must configure your Salesforce credentials in your Laravel .env file:

VariableDescription`SALESFORCE_CLIENT_ID`The **Consumer Key** from your Salesforce Connected App.`SALESFORCE_CLIENT_SECRET`The **Consumer Secret** from your Salesforce Connected App.`SALESFORCE_USERNAME`Salesforce username used for authentication.`SALESFORCE_PASSWORD`Salesforce password **plus** security token (if required).`SALESFORCE_LOGIN_URL`Salesforce login URL — usually `https://login.salesforce.com` (production) or `https://test.salesforce.com` (sandbox).`SALESFORCE_GRANT_TYPE`Salesforce `grant_type` - currently supports `password` flow (legacy) and `client_credentials``SALESFORCE_API_VERSION`Salesforce API version to use. Defaults to `58.0`#### Example .env

[](#example-env)

```
SALESFORCE_CLIENT_ID=your-client-id
SALESFORCE_CLIENT_SECRET=your-client-secret
SALESFORCE_USERNAME=your-username // password grant type only
SALESFORCE_PASSWORD=your-password-and-token // password grant type only
SALESFORCE_LOGIN_URL=https://login.salesforce.com
SALESFORCE_GRANT_TYPE=client_credentials
```

Generating Salesforce Objects
-----------------------------

[](#generating-salesforce-objects)

This package ships with an Artisan command to generate PHP classes for your Salesforce SObjects.

### All Objects

[](#all-objects)

```
php artisan salesforce:generate-objects
```

This will connect to your Salesforce instance, retrieve all available objects, and create corresponding PHP classes in the app/SalesforceObjects directory. Please be warned, if you have a large salesforce instance, with lots of objects, this will be a long running command. I recommend you generate specific objects only (as shown below).

### Specific Objects

[](#specific-objects)

You can limit generation to one or more objects using the `--objects` option:

```
php artisan salesforce:generate-objects --objects=Account,Contact,Opportunity
```

This will only generate classes for the specified Salesforce Objects.

Example Usage
-------------

[](#example-usage)

Once an object has been generated, you can make use of Eloquent style operations.

### Create an Object

[](#create-an-object)

```
$contact = Contact::create([
    'Name' => 'Test Contact'
]); // $contact will be type Contact, with the Id field populated only.
```

### List Objects

[](#list-objects)

```
Contact::fields(['Id', 'Email', 'Name__c',]) // Use fields() to specify limited field sets for queries
    ->where('Email', 'LIKE', 'maurice%')
    ->orWhere('Id', '=', '003D000002TND2QIAX')
    ->all() // Fetches ALL records, includes pagination handling for Salesforce 2000 row pages.
    ->records() // Returns collection of Contact;
```

```
Contact::fields(['Id', 'Email', 'Name__c',]) // Use fields() to specify limited field sets for queries
    ->where('Email', 'LIKE', 'maurice%')
    ->orWhere('Id', '=', '003D000002TND2QIAX')
    ->limit(20) // Set a hard limit. orderBy methods available as well.
    ->get() // Fetches without handling pages.
    ->records() // Returns collection of Contact;
```

### Find an Object

[](#find-an-object)

```
Contact::find('MyId'); // Returns an instance of Contact, runs FIELDS(ALL) behind the scenes.
```

### Update an Object

[](#update-an-object)

```
$contact = Contact::find('MyId');
$contact->update([
    'Name__c' => 'New Name'
]); // Returns no new data. Suggest a refetch/find operation afterwards to update state.
```

### Delete an Object

[](#delete-an-object)

```
$contact = Contact::find('MyId');
$contact->delete(); // Returns null
```

### Describe an Object

[](#describe-an-object)

Occasionally you'll need to obtain the metadata of an object, including Picklist values, fields, and more. This is the use case for the `describe` method, which returns the API response from a salesforce `sobject//describe`request.

```
$description = Contact::describe(); // Returns SalesforceDescription
$myPicklistValues = $description->fields->where('name', 'myField')->first()->picklistValues; // returns Collection of SalesforcePicklistValue
```

\## Working with Chatter Feeds

This package includes first-class support for Salesforce Chatter feeds, allowing you to retrieve, post, update, and comment on feed items related to any Salesforce record (e.g., an Opportunity, Account, or Case).

\### Retrieving Feed Items

You can access a record’s chatter feed through the chatter() helper:

```
$opportunity = Opportunity::find('0068d00000ABC123');

$feed = $opportunity->chatter()->all();

// Returns a collection of feed elements (posts, comments, files, etc.)
foreach ($feed as $element) {
    echo $element['actor']['displayName'] . ': ' . $element['body']['text'];
}
```

Under the hood, this calls the Salesforce Chatter REST API:

```
GET /services/data/v{api_version}/chatter/feeds/record/{recordId}/feed-elements

```

and automatically maps the response into PHP objects for easy access.

### Posting a New Message

[](#posting-a-new-message)

To create a new post on a record’s feed, call post():

```
$opportunity->chatter()->post('We should increase the deal size to £200k.');
```

This issues a POST request to:

```
POST /services/data/v{api_version}/chatter/feed-elements

```

and creates a FeedItem linked to the record.

### Updating a Message

[](#updating-a-message)

If you need to edit a feed message (your own post), you can use update():

```
$opportunity->chatter()->update('0D5xx00000ABCDe', 'Updated deal size to £250k.');
```

This sends a PATCH request to:

```
PATCH /services/data/v{api_version}/chatter/feed-elements/{feedElementId}

```

and updates the feed item’s body content.

### Commenting on a Message

[](#commenting-on-a-message)

To add a comment to an existing feed item, use comment():

```
$opportunity->chatter()->comment('0D5xx00000ABCDe', 'Agreed — let’s go for it.');
```

This issues a POST request to:

```
POST /services/data/v{api_version}/chatter/feed-elements/{feedElementId}/capabilities/comments/items

```

and appends a new FeedComment to the specified post.

\### Example Workflow

```
$opportunity = Opportunity::find('0068d00000ABC123');

// Post a message
$post = $opportunity->chatter()->post('Initial quote sent to client.');

// Add a follow-up comment
$opportunity->chatter()->comment($post['id'], 'Client requested updated pricing.');

// Retrieve all feed items
$feed = $opportunity->chatter()->all();
```

### Notes

[](#notes)

Feed actions are available for any Salesforce record with an associated Chatter feed (FeedEnabled objects). Returned data is normalized through SalesforceChatterResponse, so you can iterate and inspect feed elements easily. Posting and commenting automatically handle message segment formatting — plain text is supported by default, but future versions will support rich mentions, links, and file attachments.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance64

Regular maintenance activity

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

14

Last Release

221d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/968835a87f824d656201b8f08dc27097e4bb74b6a161dca3a33be5dd8057d819?d=identicon)[Flinty916](/maintainers/Flinty916)

---

Top Contributors

[![ethanm12343](https://avatars.githubusercontent.com/u/172038628?v=4)](https://github.com/ethanm12343 "ethanm12343 (21 commits)")[![Flinty916](https://avatars.githubusercontent.com/u/38919621?v=4)](https://github.com/Flinty916 "Flinty916 (2 commits)")

---

Tags

phplaravellaravel 12generatorservicegithubcommandtraitsactionopen-source

### Embed Badge

![Health badge](/badges/flinty916-laravel-salesforce/health.svg)

```
[![Health](https://phpackages.com/badges/flinty916-laravel-salesforce/health.svg)](https://phpackages.com/packages/flinty916-laravel-salesforce)
```

###  Alternatives

[prevailexcel/laravel-action-service-trait

A simple Laravel package to create actions, traits and services using artisan commands

143.0k](/packages/prevailexcel-laravel-action-service-trait)[goodway/laravel-nats

Nats jetstream queue driver with client for Laravel

304.8k](/packages/goodway-laravel-nats)[timwassenburg/laravel-artisan-extender

A collection of generators for Laravel

111.4k](/packages/timwassenburg-laravel-artisan-extender)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
