PHPackages                             infusionsoft/php-sdk - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. infusionsoft/php-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

infusionsoft/php-sdk
====================

PHP SDK for the Infusionsoft

1.6.8(1y ago)1292.1M↓20.6%127[48 issues](https://github.com/infusionsoft/infusionsoft-php/issues)[5 PRs](https://github.com/infusionsoft/infusionsoft-php/pulls)7MITPHPPHP &gt;=8.1

Since May 14Pushed 3mo ago65 watchersCompare

[ Source](https://github.com/infusionsoft/infusionsoft-php)[ Packagist](https://packagist.org/packages/infusionsoft/php-sdk)[ Docs](https://developer.infusionsoft.com)[ RSS](/packages/infusionsoft-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (51)Used By (7)

Infusionsoft PHP SDK
====================

[](#infusionsoft-php-sdk)

Warning

**⚠️ Deprecated**This SDK is no longer actively maintained. Please migrate to the replacement: [`keap-sdk-php`](https://github.com/infusionsoft/keap-sdk-php), available on [Packagist](https://packagist.org/packages/keap/keap-sdk).

You can use the [Migration guide from infusionsoft/php-sdk](https://github.com/infusionsoft/keap-sdk-php/blob/main/MigrationFromInfusionsoftPhpSdk.md).

[![Total Downloads](https://camo.githubusercontent.com/7de0635c86540177a04fc04b485ea9596761ea9dd38c041ba7a5957b39d31bc1/68747470733a2f2f706f7365722e707567782e6f72672f696e667573696f6e736f66742f7068702d73646b2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/infusionsoft/php-sdk)[![Latest Stable Version](https://camo.githubusercontent.com/3247ac1b54a4cc4ff2895b145c2bfef8d0af4c3aeb48302851d4b73015d21880/68747470733a2f2f706f7365722e707567782e6f72672f696e667573696f6e736f66742f7068702d73646b2f762f737461626c652e706e67)](https://packagist.org/packages/infusionsoft/php-sdk)

Version Notes
-------------

[](#version-notes)

This version implements RESTful endpoints, a new version of Guzzle, and a restructured request handler.

As of version 1.6, PHP 8.1+ is required.

### Breaking Change

[](#breaking-change)

With the Guzzle 7 upgrade, there was a refactor on the `request` function name in Infusionsoft\\Http\\ClientInterface. If you created a custom HttpClient, you'll need to update to use the new function name of `call`

If you use the `Contacts`, `Orders` or `Products` services, there are now two different classes handling each service - one for REST, one for XML-RPC. *This version of the SDK will load the REST class by default.* If you still need the XML-RPC class, pass `'xml'` as an argument when requesting the object: `$infusionsoft->orders('xml')'`

Kudos to [toddstoker](https://github.com/toddstoker) and [mattmerrill](https://github.com/mattmerrill) for their contributions to this release.

Install
-------

[](#install)

Using the composer CLI:

```
composer require infusionsoft/php-sdk

```

Or manually add it to your composer.json:

```
{
    "require": {
        "infusionsoft/php-sdk": "1.6.*"
    }
}
```

Authentication
--------------

[](#authentication)

Currently Keap supports two types of authentication for our APIs: the OAuth2 Access Code Grant and API Keys.
Developers of third-party integrations should always use our OAuth2 authentication, but developers building integrations for a single tenant may find the use of API Keys much simpler.

### OAuth2 Access Code Grant

[](#oauth2-access-code-grant)

The client ID and secret are the key and secret for your OAuth2 application found at the [Infusionsoft Developers](https://keys.developer.keap.com) website.

```
if(empty(session_id();)) session_start();

require_once 'vendor/autoload.php';

$infusionsoft = new \Infusionsoft\Infusionsoft(array(
	'clientId'     => 'XXXXXXXXXXXXXXXXXXXXXXXX',
	'clientSecret' => 'XXXXXXXXXX',
	'redirectUri'  => 'http://example.com/',
));

// If the serialized token is available in the session storage, we tell the SDK
// to use that token for subsequent requests.
if (isset($_SESSION['token'])) {
	$infusionsoft->setToken(unserialize($_SESSION['token']));
}

// If we are returning from Infusionsoft we need to exchange the code for an
// access token.
if (isset($_GET['code']) and !$infusionsoft->getToken()) {
	$_SESSION['token'] = serialize($infusionsoft->requestAccessToken($_GET['code']));
}

if ($infusionsoft->getToken()) {
	// Save the serialized token to the current session for subsequent requests
	$_SESSION['token'] = serialize($infusionsoft->getToken());

	// MAKE INFUSIONSOFT REQUEST
} else {
	echo 'Click here to authorize';
}
```

### API Keys

[](#api-keys)

API Keys are a "password" for your data in an application and should always be treated like a dangerous secret.

In our UI you will find an API Settings screen which divides API Keys into two distinct categories:

- `Personal Access Tokens`, which are scoped to your own user account and can only see and manipulate the data you have access to.
- `Service Account Keys`, which can only be authorized by an Administrator and have full access to the data stored in the application.

For additional information on how to authorize and use PATs and SAKs please see our [developer documentation](https://developer.infusionsoft.com/pat-and-sak/).

```
require_once 'vendor/autoload.php';

$infusionsoft = new \Infusionsoft\Infusionsoft(array(
  'apikey' => $APIKeyRetrievedFromCredentialStorage,
));

// MAKE INFUSIONSOFT REQUEST
```

Making XML-RPC Requests
-----------------------

[](#making-xml-rpc-requests)

```
require_once 'vendor/autoload.php';

//
// Setup your Infusionsoft object here, then set your token either via the request or from storage
// As of v1.3 contacts defaults to rest
$infusionsoft->setToken($myTokenObject);

$infusionsoft->contacts('xml')->add(array('FirstName' => 'John', 'LastName' => 'Doe'));
```

Making REST Requests
--------------------

[](#making-rest-requests)

The PHP SDK is setup to allow easy access to REST endpoints. In general, a single result is returned as a Class representing that object, and multiple objects are returned as an Infusionsoft Collection, which is simply a wrapper around an array of results making them easier to manage.

The standard REST operations are mapped to a series of simple functions. We'll use the Tasks service for our examples, but the operations below work on all documented Infusionsoft REST services.

To retrieve all tasks:

```
$tasks = $infusionsoft->tasks()->all();
```

To retrieve a single task:

```
$task = $infusionsoft->tasks()->find($taskId);
```

To query only completed tasks:

```
$tasks = $infusionsoft->tasks()->where('status', 'completed')->get();
```

You can chain `where()` as many times as you'd like, or you can pass an array:

```
$tasks = $infusionsoft->tasks()->where(['status' => 'completed', 'user_id' => '45'])->get();
```

To create a task:

```
$task = $infusionsoft->tasks()->create([
   'title' => 'My First Task',
   'description' => 'Better get it done!'
]);
```

Then update that task:

```
$task->title = 'A better task title';
$task->save();
```

And finally, to delete the task:

```
$task->delete();
```

Several REST services have a `/sync` endpoint, which we provide a helper method for:

```
$tasks = $infusionsoft->tasks()->sync($syncId);
```

This returns a list of tasks created or updated since the sync ID was last generated.

```
require_once 'vendor/autoload.php';

//
// Setup your Infusionsoft object here, then set your token either via the request or from storage
//
$infusionsoft->setToken($myTokenObject);

$infusionsoft->tasks()->find('1');
```

### Dates

[](#dates)

DateTime objects are used instead of a DateTime string where the date(time) is a parameter in the method.

```
$datetime = new \DateTime('now',new \DateTimeZone('America/New_York'));
```

### Debugging

[](#debugging)

To enable debugging of requests and responses, you need to set the debug flag to try by using:

```
$infusionsoft->setDebug(true);
```

Once enabled, logs will by default be written to an array that can be accessed by:

```
$infusionsoft->getLogs();
```

You can utilize the powerful logging plugin built into Guzzle by using one of the available adapters. For example, to use the Monolog writer to write to a file:

```
use Monolog\Handler\StreamHandler;
use Monolog\Logger;

$logger = new Logger('client');
$logger->pushHandler(new StreamHandler('infusionsoft.log'));

$infusionsoft->setHttpLogAdapter($logger);
```

Testing
-------

[](#testing)

```
$ phpunit
```

Laravel Framework Support
-------------------------

[](#laravel-framework-support)

### Laravel &lt; 5.5

[](#laravel--55)

In config/app.php, register the service provider

```
Infusionsoft\FrameworkSupport\Laravel\InfusionsoftServiceProvider::class,

```

Register the Facade (optional)

```
'Infusionsoft'       => Infusionsoft\FrameworkSupport\Laravel\InfusionsoftFacade::class

```

### Laravel &gt;= 5.5

[](#laravel--55-1)

In Laravel 5.5, package auto-discovery was added. The service provider and facade will be detected for you. Continue by publishing the vendor assets and adding your env variables.

Publish the config

```
php artisan vendor:publish --provider="Infusionsoft\FrameworkSupport\Laravel\InfusionsoftServiceProvider"

```

Set your env variables

```
INFUSIONSOFT_CLIENT_ID=xxxxxxxx
INFUSIONSOFT_SECRET=xxxxxxxx
INFUSIONSOFT_REDIRECT_URL=http://localhost/auth/callback

```

Access Infusionsoft from the Facade or Binding

```
 $data = Infusionsoft::data()->query("Contact",1000,0,['Id' => '123'],['Id','FirstName','LastName','Email'], 'Id', false);

 $data = app('infusionsoft')->data()->query("Contact",1000,0,['Id' => '123'],['Id','FirstName','LastName','Email'], 'Id', false);

```

Lumen Service Provider
----------------------

[](#lumen-service-provider)

In bootstrap/app.php, register the service provider

```
$app->register(Infusionsoft\FrameworkSupport\Lumen\InfusionsoftServiceProvider::class);

```

Set your env variables (make sure you're loading your env file in app.php)

```
INFUSIONSOFT_CLIENT_ID=xxxxxxxx
INFUSIONSOFT_SECRET=xxxxxxxx
INFUSIONSOFT_REDIRECT_URL=http://localhost/auth/callback

```

Access Infusionsoft from the Binding

```
 $data = app('infusionsoft')->data()->query("Contact",1000,0,['Id' => '123'],['Id','FirstName','LastName','Email'], 'Id', false);

```

SDK Development
---------------

[](#sdk-development)

You can install the Composer dependencies without installing Composer:

```
docker compose run composer

```

You can access the samples by spinning up the Docker container for the Composer dependencies:

```
docker compose up -d

```

Tests can be executed without installing PHP in the host environment (while the main container is running):

```
docker exec -it infusionsoft-php /var/www/html/vendor/bin/phpunit tests

```

If using Docker for Windows, please see `.env` for additional details.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/infusionsoft/infusionsoft-php/blob/master/CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/infusionsoft/infusionsoft-php/blob/master/LICENSE) for more information.

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance59

Moderate activity, may be stable

Popularity59

Moderate usage in the ecosystem

Community41

Growing community involvement

Maturity85

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~88 days

Recently: every ~72 days

Total

46

Last Release

396d ago

Major Versions

1.0.0-beta2 → 5.3.x-dev2015-06-22

PHP version history (7 changes)1.0.0-beta1PHP &gt;=5.3.0

1.0.0-beta2PHP &gt;=5.3.3

1.1.0PHP &gt;=5.4

1.2.0PHP &gt;=5.5

1.4.1PHP &gt;=7.0

1.5.0PHP &gt;=7.3

1.6.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/3568a935cfa16d7e8c3c475d472d97e70e04d0e9f511394e2c9c2df42f818bfd?d=identicon)[Infusionsoft](/maintainers/Infusionsoft)

---

Top Contributors

[![andrewryno](https://avatars.githubusercontent.com/u/50643?v=4)](https://github.com/andrewryno "andrewryno (47 commits)")[![ROMzombie](https://avatars.githubusercontent.com/u/2767055?v=4)](https://github.com/ROMzombie "ROMzombie (34 commits)")[![MicFai](https://avatars.githubusercontent.com/u/131530258?v=4)](https://github.com/MicFai "MicFai (30 commits)")[![kressaty](https://avatars.githubusercontent.com/u/289165?v=4)](https://github.com/kressaty "kressaty (27 commits)")[![sdanyalk](https://avatars.githubusercontent.com/u/15016472?v=4)](https://github.com/sdanyalk "sdanyalk (7 commits)")[![mfairch](https://avatars.githubusercontent.com/u/2048552?v=4)](https://github.com/mfairch "mfairch (7 commits)")[![nova4005](https://avatars.githubusercontent.com/u/3578444?v=4)](https://github.com/nova4005 "nova4005 (6 commits)")[![skeemer](https://avatars.githubusercontent.com/u/864069?v=4)](https://github.com/skeemer "skeemer (6 commits)")[![jgourley](https://avatars.githubusercontent.com/u/1693390?v=4)](https://github.com/jgourley "jgourley (6 commits)")[![ajohnson6494](https://avatars.githubusercontent.com/u/5192820?v=4)](https://github.com/ajohnson6494 "ajohnson6494 (5 commits)")[![mickaelsavafi-keap](https://avatars.githubusercontent.com/u/140547873?v=4)](https://github.com/mickaelsavafi-keap "mickaelsavafi-keap (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![toddstoker](https://avatars.githubusercontent.com/u/248347?v=4)](https://github.com/toddstoker "toddstoker (4 commits)")[![jlarge11](https://avatars.githubusercontent.com/u/6137466?v=4)](https://github.com/jlarge11 "jlarge11 (3 commits)")[![skylord123](https://avatars.githubusercontent.com/u/3412313?v=4)](https://github.com/skylord123 "skylord123 (3 commits)")[![mattmerrill](https://avatars.githubusercontent.com/u/231331?v=4)](https://github.com/mattmerrill "mattmerrill (3 commits)")[![mfadul24](https://avatars.githubusercontent.com/u/86224001?v=4)](https://github.com/mfadul24 "mfadul24 (3 commits)")[![Ultimater](https://avatars.githubusercontent.com/u/1922199?v=4)](https://github.com/Ultimater "Ultimater (2 commits)")[![igorsantos07](https://avatars.githubusercontent.com/u/532299?v=4)](https://github.com/igorsantos07 "igorsantos07 (1 commits)")[![ryanlholt](https://avatars.githubusercontent.com/u/72558696?v=4)](https://github.com/ryanlholt "ryanlholt (1 commits)")

---

Tags

sdkinfusionsoft

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/infusionsoft-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/infusionsoft-php-sdk/health.svg)](https://phpackages.com/packages/infusionsoft-php-sdk)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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