PHPackages                             matthewpoer/php-salesforce-wrapper - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. matthewpoer/php-salesforce-wrapper

ActiveLibrary[Testing &amp; Quality](/categories/testing)

matthewpoer/php-salesforce-wrapper
==================================

A PHP wrapper for some common Lightning Platform REST API functions

694PHP

Since May 2Pushed 6y ago1 watchersCompare

[ Source](https://github.com/matthewpoer/php-salesforce-wrapper)[ Packagist](https://packagist.org/packages/matthewpoer/php-salesforce-wrapper)[ RSS](/packages/matthewpoer-php-salesforce-wrapper/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-salesforce-wrapper
======================

[](#php-salesforce-wrapper)

Using Pest for REST
-------------------

[](#using-pest-for-rest)

[Pest](https://github.com/educoder/pest) is a PHP client library for RESTful web services. I found it to be a minimal and effective back-bone for this project. The Pest dependency is handled by composer.

Thanks @Educoder!

Composer Install
----------------

[](#composer-install)

```
composer require matthewpoer/php-salesforce-wrapper:dev-master
```

Get Started
-----------

[](#get-started)

### Authentication

[](#authentication)

Authentication with Salesforce occurs upon instantiation of the wrapper.

```
try {
  $sfdc = new php_sfdc_wrapper(
    SFDC_BASE_URL,
    SFDC_CLIENT_ID,
    SFDC_CLIENT_SECRET,
    SFDC_USERNAME,
    SFDC_PASSWORD,
    SFDC_SECURITY_TOKEN
  );
} catch (\Exception $e) {
  $log->critical('Error authenticating with Salesforce. Exception occurred.', array(
    'Exception' => $e->getMessage()
  ));
  die('Error authenticating with Salesforce. Exception occurred.' . PHP_EOL);
}
```

### Create an Account

[](#create-an-account)

```
try {
  $account_id = $sfdc->create('Account', array(
    'BillingCity' => 'San Francisco',
    'BillingCountry' => 'United States',
    'BillingPostalCode' => '94105',
    'BillingState' => 'California',
    'BillingStreet' => 'The Landmark @ One Market Suite 300',
    'Name' => 'Salesforce.com',
  ));
} catch (\Exception $e) {
  $message = $e->getMessage();
  $log->critical($message);
  die('Error creating Salesforce Account. Exception occurred.' . PHP_EOL);
}
```

### Delete an Account

[](#delete-an-account)

```
try {
  $account_id = $sfdc->delete('Account', $account_id);
} catch (\Exception $e) {
  $message = $e->getMessage();
  $log->critical($message);
  die('Error deleting Salesforce Account. Exception occurred.' . PHP_EOL);
}
```

### Find an Account by Name

[](#find-an-account-by-name)

The `query` method accepts as parameters,

1. an s0bject name
2. an array of fields desired in the result, defaulting to just the `Id` and `Name` fields
3. an string to use as the SOQL query's `WHERE` clause
4. a boolean on whether or not a result should be required (default TRUE). If this is TRUE then the wrapper will throw an exception when no records are found matching the conditions in the `WHERE` clause.

```
try {
  $accounts = $sfdc->query(
    'Account',
    array('Id','Name'),
    "name='Salesforce.com'",
    FALSE
  );
  foreach($accounts as $account) {
    echo "Found account with ID of " . $account['Id'] . PHP_EOL;
  }
} catch (\Exception $e) {
  $message = $e->getMessage();
  $log->critical($message);
  die('Error querying for the Salesforce Account. Exception occurred.' . PHP_EOL);
}
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9852f65a29a1d5902c94906e1ca974ab9a08f897ce1cd7215a19141ea88312a?d=identicon)[matthewpoer](/maintainers/matthewpoer)

---

Top Contributors

[![matthewpoer](https://avatars.githubusercontent.com/u/727257?v=4)](https://github.com/matthewpoer "matthewpoer (9 commits)")

---

Tags

apilightningpestphprestsalesforce

### Embed Badge

![Health badge](/badges/matthewpoer-php-salesforce-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/matthewpoer-php-salesforce-wrapper/health.svg)](https://phpackages.com/packages/matthewpoer-php-salesforce-wrapper)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M679](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M571](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)

PHPackages © 2026

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