PHPackages                             dennisbold/soap-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. dennisbold/soap-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

dennisbold/soap-client
======================

A PHP client for the Salesforce SOAP API

0.1.8(6y ago)041MITPHPPHP &gt;=7.2

Since Apr 5Pushed 6y agoCompare

[ Source](https://github.com/DennisBold/soap-client)[ Packagist](https://packagist.org/packages/dennisbold/soap-client)[ RSS](/packages/dennisbold-soap-client/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (4)Versions (10)Used By (0)

PHPForce Soap Client: a PHP client for the Salesforce SOAP API
==============================================================

[](#phpforce-soap-client-a-php-client-for-the-salesforce-soap-api)

[![](https://camo.githubusercontent.com/c2b2c81ecf472d8e778ae449dbe66c3c830bb790f6b7a8a0ff95313e545d313c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f636f6d736176652f736f61702d636c69656e74)](https://camo.githubusercontent.com/c2b2c81ecf472d8e778ae449dbe66c3c830bb790f6b7a8a0ff95313e545d313c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f636f6d736176652f736f61702d636c69656e74)[![](https://camo.githubusercontent.com/88e964ae47e64d25251bc528d97fd066d09aab289db9575895fba6d16afbcb3c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d736176652f736f61702d636c69656e74)](https://camo.githubusercontent.com/88e964ae47e64d25251bc528d97fd066d09aab289db9575895fba6d16afbcb3c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d736176652f736f61702d636c69656e74)

Introduction
------------

[](#introduction)

This library is a client for the [Salesforce SOAP API](http://www.salesforce.com/us/developer/docs/api/index.htm), and intended as a replacement for the [Force.com Tookit for PHP](http://wiki.developerforce.com/page/Force.com_Toolkit_for_PHP).

### Features

[](#features)

This library’s features include the following.

- Automatic conversion between PHP and SOAP date and datetime objects.
- Automatic conversion of Salesforce (UTC) times to your local timezone.
- Easily extensible through events: add custom logging, caching, error handling etc.
- Iterating over large results sets that require multiple calls to the API is easy through the record iterator.
- The BulkSaver helps you stay within your Salesforce API limits by using bulk creates, deletes, updates and upserts.
- Completely unit tested (still working on that one).
- Use the client in conjunction with the Symfony2 [Mapper Bundle](https://github.com/ddeboer/DdeboerSalesforceMapperBundle)to get even easier access to your Salesforce data.

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

[](#installation)

This library is available on [Packagist](http://packagist.org/packages/phpforce/soap-client). The recommended way to install this library is through [Composer](http://getcomposer.org):

```
$ php composer.phar require phpforce/soap-client dev-master
```

Usage
-----

[](#usage)

### The client

[](#the-client)

Use the client to query and manipulate your organisation’s Salesforce data. First construct a client using the builder:

```
$builder = new \Phpforce\SoapClient\ClientBuilder(
  '/path/to/your/salesforce/wsdl/sandbox.enterprise.wsdl.xml',
  'username',
  'password',
  'security_token'
);

$client = $builder->build();
```

### SOQL queries

[](#soql-queries)

```
$results = $client->query('select Name, SystemModstamp from Account limit 5');
```

This will fetch five accounts from Salesforce and return them as a `RecordIterator`. You can now iterate over the results. The account’s `SystemModstamp` is returned as a `\DateTime` object:

```
foreach ($results as $account) {
    echo 'Last modified: ' . $account->SystemModstamp->format('Y-m-d H:i:') . "\n";
}
```

### One-to-many relations (subqueries)

[](#one-to-many-relations-subqueries)

Results from [subqueries](http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select.htm)are themselves returned as record iterators. So:

```
$accounts = $client->query(
    'select Id, (select Id, Name from Contacts) from Account limit 10'
);

foreach ($accounts as $account) {
    if (isset($account->Contacts)) {
        foreach ($account->Contacts as $contact) {
            echo sprintf("Contact %s has name %s\n", $contact->Id, $contact->Name);
        }
    }
}
```

### Fetching large numbers of records

[](#fetching-large-numbers-of-records)

If you issue a query that returns over 2000 records, only the first 2000 records will be returned by the Salesforce API. Using the `queryLocator`, you can then fetch the following results in batches of 2000. The record iterator does this automatically for you:

```
$accounts = $client->query('Select Name from Account');
echo $accounts->count() . ' accounts returned';
foreach ($accounts as $account) {
    // This will iterate over the 2000 first accounts, then fetch the next 2000
    // and iterate over these, etc. In the end, all your organisations’s accounts
    // will be iterated over.
}
```

### Logging

[](#logging)

To enable logging for the client, call `withLog()` on the builder. For instance when using [Monolog](https://github.com/Seldaek/monolog):

```
$log = new \Monolog\Logger('name');
$log->pushHandler(new \Monolog\Handler\StreamHandler('path/to/your.log'));

$builder = new \Phpforce\SoapClient\ClientBuilder(
  '/path/to/your/salesforce/wsdl/sandbox.enterprise.wsdl.xml',
  'username',
  'password',
  'security_token'
);
$client = $builder->withLog($log)
  ->build();
```

All requests to the Salesforce API, as well as the responses and any errors that it returns, will now be logged.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.8% 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 ~213 days

Recently: every ~220 days

Total

9

Last Release

2351d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3.0

0.1.8PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/95e76695dd1e3b54931c53487958427b44eba3cd65aa6fac6c9cee4de1470765?d=identicon)[mrdennisbold](/maintainers/mrdennisbold)

---

Top Contributors

[![ddeboer](https://avatars.githubusercontent.com/u/89267?v=4)](https://github.com/ddeboer "ddeboer (99 commits)")[![christiaan](https://avatars.githubusercontent.com/u/118490?v=4)](https://github.com/christiaan "christiaan (3 commits)")[![simonharris](https://avatars.githubusercontent.com/u/385725?v=4)](https://github.com/simonharris "simonharris (3 commits)")[![shaunhardy](https://avatars.githubusercontent.com/u/993596?v=4)](https://github.com/shaunhardy "shaunhardy (1 commits)")[![j-d](https://avatars.githubusercontent.com/u/1140726?v=4)](https://github.com/j-d "j-d (1 commits)")[![ikrasnykh](https://avatars.githubusercontent.com/u/532166?v=4)](https://github.com/ikrasnykh "ikrasnykh (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")

---

Tags

soapcrmsalesforceforce.comweb services

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dennisbold-soap-client/health.svg)

```
[![Health](https://phpackages.com/badges/dennisbold-soap-client/health.svg)](https://phpackages.com/packages/dennisbold-soap-client)
```

###  Alternatives

[phpforce/soap-client

A PHP client for the Salesforce SOAP API

831.9M1](/packages/phpforce-soap-client)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[xsolve-pl/salesforce-client

Salesforce REST client for PHP

3018.1k](/packages/xsolve-pl-salesforce-client)[meabed/php-parallel-soap

Multi curl SoapClient that allow to perform multiple requests to SoapServer

4389.1k](/packages/meabed-php-parallel-soap)

PHPackages © 2026

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