PHPackages                             spinen/connectwise-php-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. [API Development](/categories/api)
4. /
5. spinen/connectwise-php-client

ActiveLibrary[API Development](/categories/api)

spinen/connectwise-php-client
=============================

SPINEN's PHP Client for ConnectWise.

6.2.0(2y ago)166.2k8[1 PRs](https://github.com/spinen/connectwise-php-client/pulls)MITPHPPHP ^8.0.2

Since Apr 12Pushed 2y ago11 watchersCompare

[ Source](https://github.com/spinen/connectwise-php-client)[ Packagist](https://packagist.org/packages/spinen/connectwise-php-client)[ RSS](/packages/spinen-connectwise-php-client/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (4)Dependencies (8)Versions (63)Used By (0)

SPINEN's ConnectWise PHP Client
===============================

[](#spinens-connectwise-php-client)

[![Latest Stable Version](https://camo.githubusercontent.com/69f94160fbc352def79f5dfd57e5d68ff2af3907994f6487c60c73c81b3c057f/68747470733a2f2f706f7365722e707567782e6f72672f7370696e656e2f636f6e6e656374776973652d7068702d636c69656e742f762f737461626c65)](https://packagist.org/packages/spinen/connectwise-php-client)[![Total Downloads](https://camo.githubusercontent.com/25a9eab31887a9f492f5377e3d0745e3557d7786190ca82a7221ceb00281b8eb/68747470733a2f2f706f7365722e707567782e6f72672f7370696e656e2f636f6e6e656374776973652d7068702d636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/spinen/connectwise-php-client)[![Latest Unstable Version](https://camo.githubusercontent.com/4d2c976233cea09ccc374b1a5ae8b34794cce036e9e7f027e5a4295242f06630/68747470733a2f2f706f7365722e707567782e6f72672f7370696e656e2f636f6e6e656374776973652d7068702d636c69656e742f762f756e737461626c65)](https://packagist.org/packages/spinen/connectwise-php-client)[![License](https://camo.githubusercontent.com/0e8eba1ffcd2139a110452b62b3eba7ad573f9d5f95da994652a0a059afebbdc/68747470733a2f2f706f7365722e707567782e6f72672f7370696e656e2f636f6e6e656374776973652d7068702d636c69656e742f6c6963656e7365)](https://packagist.org/packages/spinen/connectwise-php-client)

PHP client for the RESTful ConnectWise APIs.

We solely use [Laravel](http://www.laravel.com) for our applications, so there are some Laravel specific files that you can use if you are using this client in a Laravel application. We have tried to make sure that you can use the client outside of Laravel, and have some documentation about it below.

Build Status
------------

[](#build-status)

BranchStatusCoverageCode QualityDevelop[![Build Status](https://github.com/spinen/connectwise-php-client/workflows/CI/badge.svg?branch=develop)](https://github.com/spinen/connectwise-php-client/workflows/CI/badge.svg?branch=develop)[![Code Coverage](https://camo.githubusercontent.com/4234e8d656d8d01c87cc1c475a5891a5f9d04af7284b22eb4c5108d5e8602e85/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e656e2f636f6e6e656374776973652d7068702d636c69656e742f6261646765732f636f7665726167652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/?branch=develop)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/12d6bd63696cf11473e98d6a8ea86e4a463bd325b51707c894a6c4668e8e3836/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e656e2f636f6e6e656374776973652d7068702d636c69656e742f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/?branch=develop)Master[![Build Status](https://github.com/spinen/connectwise-php-client/workflows/CI/badge.svg?branch=master)](https://github.com/spinen/connectwise-php-client/workflows/CI/badge.svg?branch=master)[![Code Coverage](https://camo.githubusercontent.com/5679e9c0bc5e3a4ab6ce536465dd4f471d100e1ed9e1b025e69f4f0d49aa85d6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e656e2f636f6e6e656374776973652d7068702d636c69656e742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/94e9e7fb9efacdc288cfb9d911c944882b7b4edec27a7e449b708229f7ec4372/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e656e2f636f6e6e656374776973652d7068702d636c69656e742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/?branch=master)Note about the integration
--------------------------

[](#note-about-the-integration)

We are using the "Member Impersonation" model where you set up an integrator username &amp; password with access to the "Member API", which makes all calls to ConnectWise performed under the permission of the user (member id) of the application.

We make all of our ConnectWise users' member ID equal to their email (i.e.  has a member ID of joedoe in ConnectWise) \[NOTE: The "." was removed from joe.doe as ConnectWise does not allow periods in the member ID\]. By following this convention, we can infer the member ID from the logged in user's email address in our applications. We have included a trait that you can use on the User model that will perform the logic above.

As of 2019.3, they require a `clientId` when connecting to the API, so you will need to register for one here...

Supported Actions
-----------------

[](#supported-actions)

The client supports the standard `http verbs` plus one extra one...

- `delete`
- `get` (ConnectWise default pagination is 25 records, so unless you specify a different `pageSize`, you will get 25 records)
- `getAll` (Makes as many needed API calls to get all of the records in the collection. You should be very careful when using this method as your system may run out of memory.)
- `head`
- `put`
- `post`
- `patch`

Models
------

[](#models)

The responses are cast into models with the properties cast into the types as defined in the Swagger documentation. You can review the models in the `src/Models` folder. There is a property named `casts` on each model that instructs the factory on how to cast the properties from the response. If the `casts` property is empty, then the properties are not defined in the swagger, so an array is returned.

Relationships
-------------

[](#relationships)

Some of the responses have links to the related resource. If a property has a relationship, you can call it as a method, and the additional calls are automatically made &amp; returned. The value is stored in place of the original data, so once it is loaded it is cached.

```
$ psysh
Psy Shell v0.8.18 (PHP 7.2.17 — cli) by Justin Hileman

>>> // Using "$member" object for this example
>>> get_class($member) // Verify that it is a "Member"
=> "Spinen\ConnectWise\Models\v2019_3\System\Member"
>>> get_class($member->defaultLocation) // On load, the "defaultLocation" is a "SystemLocationReference" object
=> "Spinen\ConnectWise\Models\v2019_3\System\SystemLocationReference"
>>> get_class($member->defaultLocation()) // Call it as a method to load the relationship
=> "Spinen\ConnectWise\Models\v2019_3\System\Location"
>>> get_class($member->defaultLocation) // Now it is cached as a "Location" object
=> "Spinen\ConnectWise\Models\v2019_3\System\Location"

```

There are may also be "related" properties in the "\_info" property that you can have the system load for you. \[NOTE: This does a `getAll` for the related properties, so it will make as many API calls as needed to get all of the related items\]

```
$ psysh
Psy Shell v0.8.18 (PHP 7.2.17 — cli) by Justin Hileman

>>> // Using "$company" object for this example
>>> get_class($company) // Verify that it is a "Company"
=> "Spinen\ConnectWise\Models\v2018_6\Company\Company"
>>> $company->_info // Look for potential relations
=> Spinen\ConnectWise\Models\v2018_6\Company\Metadata {#5678
     +"lastUpdated": "2019-05-20T18:12:38Z",
     +"updatedBy": "someone",
     +"dateEntered": "2006-06-21T16:04:59Z",
     +"enteredBy": "someone",
     +"contacts_href": "https://some.host/v4_6_release/apis/3.0/company/contacts?conditions=company/id=250",
     +"agreements_href": "https://some.host/v4_6_release/apis/3.0/finance/agreements?conditions=company/id=250",
     +"tickets_href": "https://some.host/v4_6_release/apis/3.0/service/tickets?conditions=company/id=250",
     +"opportunities_href": "https://some.host/v4_6_release/apis/3.0/sales/opportunities?conditions=company/id=250",
     +"activities_href": "https://some.host/v4_6_release/apis/3.0/sales/activities?conditions=company/id=250",
     +"projects_href": "https://some.host/v4_6_release/apis/3.0/project/projects?conditions=company/id=250",
     +"configurations_href": "https://some.host/v4_6_release/apis/3.0/company/configurations?conditions=company/id=250",
     +"orders_href": "https://some.host/v4_6_release/apis/3.0/sales/orders?conditions=company/id=250",
     +"documents_href": "https://some.host/v4_6_release/apis/3.0/system/documents?recordType=Company&recordId=250",
     +"sites_href": "https://some.host/v4_6_release/apis/3.0/company/companies/250/sites",
     +"teams_href": "https://some.host/v4_6_release/apis/3.0/company/companies/250/teams",
     +"reports_href": "https://some.host/v4_6_release/apis/3.0/company/companies/250/managementSummaryReports",
     +"notes_href": "https://some.host/v4_6_release/apis/3.0/company/companies/250/notes",
   }
>>> isset($company->agreements) // Not loaded before the call
=> false
>>> $company->agreements // Client goes to get "agreements" from the $company->_info->agreements_fref URI
=> Spinen\ConnectWise\Support\Collection {#6123
     // Removed to make example shorter
   }
>>> isset($company->agreements) // Cached & loaded for next call
=> true

```

Install
-------

[](#install)

Install the ConnectWise PHP Client:

```
$ composer require spinen/connectwise-php-client
```

Laravel Configuration and Usage
-------------------------------

[](#laravel-configuration-and-usage)

### For &gt;= Laravel 5.5, you are done with the installation

[](#for--laravel-55-you-are-done-with-the-installation)

The package uses the [auto registration feature](https://laravel.com/docs/5.8/packages#package-discovery) of Laravel 5.

### For &lt; Laravel 5.5, you have to register the Service Provider

[](#for--laravel-55-you-have-to-register-the-service-provider)

1. Add the provider to `config/app.php`

```
    'providers' => [
        # other providers omitted
        Spinen\ConnectWise\Laravel\ServiceProvider::class,
    ],
```

2. \[Optional\] Add the alias to `config/app.php`

```
    'aliases' => [
        # other aliases omitted
        'ConnectWise' => Spinen\ConnectWise\Laravel\Facades\ConnectWise::class,
    ],
```

### Configuration

[](#configuration)

1. Add the following to `config/services.php`...

```
    'connectwise' =>  [
        'client_id' => env('CW_CLIENT_ID'),
        'company_id' => env('CW_COMPANY_ID'),
        // Optional member id to use if there is not a logged in user
        'default_member_id' => env('CW_DEFAULT_MEMBER_ID'),
        'integrator' => env('CW_INTEGRATOR'),
        'password' => env('CW_PASSWORD'),
        'url' => env('CW_URL'),
        // Optional version of the API models to use
        //'version' => '' // default is the latest supported
    ],
```

2. Add the appropriate values to your `.env`...

```
CW_CLIENT_ID=
CW_COMPANY_ID=
CW_DEFAULT_MEMBER_ID=
CW_INTEGRATOR=
CW_PASSWORD=
CW_URL=https://
```

3. Use the `ConnectWiseMemberIdFromEmail` trait on the User model, which is located at `Spinen\ConnectWise\Laravel\ConnectWiseMemberIdFromEmail`, if your ConnectWise member\_id is a match to your email as described above. If you do not follow that convention, then you can define your own `getConnectWiseMemberIdAttribute` accessor on the User model or just add a `connect_wise_member_id` column to your user table that you populate with the appropriate values.

### Usage

[](#usage)

Here is an example of getting the system information...

As of version 3.1.0, the response is either a Laravel collection of models or a single model. You can see the models in `src/Models`. They all extend `Spinen\ConnectWise\Support`, so you can see the methods that they provide.

```
$ php artisan tinker
Psy Shell v0.8.0 (PHP 7.0.14 — cli) by Justin Hileman
>>> Auth::loginUsingId(1); // If not useing the default member id
=> App\User {#983
     id: "1",
     first_name: "Joe",
     last_name: "Doe",
     email: "joe.doe@domain.tld",
     admin: "0",
     created_at: "2017-01-02 18:30:47",
     updated_at: "2017-01-12 22:22:39",
     logged_in_at: "2017-01-12 22:22:39",
     deleted_at: null,
   }
>>> $cw = app('Spinen\ConnectWise\Api\Client');
=> Spinen\ConnectWise\Api\Client {#934}
>>> $info = $cw->get('system/info');
=> Spinen\ConnectWise\Models\v2019_3\System\Info {#1008}
>>> $info->toArray();
=> [
     "version" => "v2016.6.43325",
     "isCloud" => false,
     "serverTimeZone" => "Eastern Standard Time",
   ]
>>> $info->toJson()
=> "{"version":"v2016.6.43325","isCloud":false,"serverTimeZone":"Eastern Standard Time"}"
>>> $info->isCloud
=> false
>>> $info['isCloud'];
=> false

```

Same call using the facade...

```
$ php artisan tinker
Psy Shell v0.8.0 (PHP 7.0.14 — cli) by Justin Hileman
>>> Auth::loginUsingId(1);  // If not useing the default member id
=> App\User {#983
     id: "1",
     first_name: "Joe",
     last_name: "Doe",
     email: "joe.doe@domain.tld",
     admin: "0",
     created_at: "2017-01-02 18:30:47",
     updated_at: "2017-01-12 22:22:39",
     logged_in_at: "2017-01-12 22:22:39",
     deleted_at: null,
   }
>>> ConnectWise::get('system/info');
=> Spinen\ConnectWise\Models\v2019_3\System\Info {#1005}
>>> ConnectWise::get('system/info')->toArray();
=> [
        "version" => "v2018.6.59996",
        "isCloud" => false,
        "serverTimeZone" => "Eastern Standard Time",
        "licenseBits" => [
          // ... All of the properties
        ],
        "cloudRegion" => "NA",
      ]
>>> ConnectWise::get('system/info')->toJson();
=> "{"version":"v2018.6.59996",...}"
>>> ConnectWise::get('system/info')->isCloud;
=> false
>>> ConnectWise::get('system/info')['isCloud'];
=> false
>>>

```

Non-Laravel Usage
-----------------

[](#non-laravel-usage)

To use the client outside of Laravel, you just need to new-up the objects...

```
$ psysh
Psy Shell v0.8.18 (PHP 7.2.17 — cli) by Justin Hileman

>>> // New-up objects
>>> $token = (new Spinen\ConnectWise\Api\Token())->setCompanyId('')->setMemberId('');
=> Spinen\ConnectWise\Api\Token {#208}
>>> $guzzle = new GuzzleHttp\Client();
=> GuzzleHttp\Client {#196}
>>> $resolver = new Spinen\ConnectWise\Support\ModelResolver();
=> Spinen\ConnectWise\Support\ModelResolver {#201}
>>> $client = (new Spinen\ConnectWise\Api\Client($token, $guzzle, $resolver))->setClientId('')->setIntegrator('')->setPassword('')->setUrl('https://');
=> Spinen\ConnectWise\Api\Client {#231}
>>> $info = $client->get('system/info');                                                                                                                     => Spinen\ConnectWise\Models\v2019_3\System\Info {#237}
>>> $info->toArray();
=> [
     "version" => "v2018.6.59996",
     "isCloud" => false,
     "serverTimeZone" => "Eastern Standard Time",
     "licenseBits" => [
       // ... All of the properties
     ],
     "cloudRegion" => "NA",
   ]
>>> // Set client to use different version
>>> $client->setVersion('2019.1')
=> Spinen\ConnectWise\Api\Client {#231}
>>> $info = $client->get('system/info');
>>> /// NOTE: the version in the namespace
=> Spinen\ConnectWise\Models\v2019_1\System\Info {#235}

```

Supported API Model Versions
----------------------------

[](#supported-api-model-versions)

You can specify the version of the models you want in 1 of 3 ways...

1. The 4th parameter in the `Client` constructor
2. Calling the `setVersion` method on the `client` object
3. \[Laravel only\] Setting the `version` property in the config

The supported versions are:

- 2018.4
- 2018.5
- 2018.6
- 2019.1
- 2019.2
- 2019.3
- 2019.4
- 2019.5 `(default)`

You can see the differences of the models by looking at the `casts` property on the individual `models` in `src/Models/` directory.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 83.4% 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 ~64 days

Recently: every ~285 days

Total

52

Last Release

770d ago

Major Versions

2.6.0 → 3.0.02017-01-08

3.5.0 → 4.0.02018-10-17

4.0.2 → 5.0.02019-05-10

4.0.3 → 5.0.22019-05-27

5.6.1 → 6.0.02023-04-08

PHP version history (5 changes)2.0.0PHP &gt;=5.4.0

3.0.0PHP &gt;=7

3.4.0PHP &gt;=7.1

5.4.0PHP &gt;=7.2

6.0.0PHP ^8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/a082f934783fa6f391c37fc7e7ca71f84e17219471cadd17a8b8b85b42c2c9c1?d=identicon)[david.mathews](/maintainers/david.mathews)

![](https://www.gravatar.com/avatar/782b3ad6f100c625875d6a8f00222d0e08e0c6f0956ef757e43a38441594c013?d=identicon)[jimmypuckett](/maintainers/jimmypuckett)

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

---

Top Contributors

[![jimmypuckett](https://avatars.githubusercontent.com/u/3220069?v=4)](https://github.com/jimmypuckett "jimmypuckett (336 commits)")[![ssfinney](https://avatars.githubusercontent.com/u/1596394?v=4)](https://github.com/ssfinney "ssfinney (67 commits)")

---

Tags

apiapi-clientclientconnectwiseconnectwise-managelaravellaravel-packagespinenclientconnectwisespinen

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/spinen-connectwise-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/spinen-connectwise-php-client/health.svg)](https://phpackages.com/packages/spinen-connectwise-php-client)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[spinen/laravel-clickup

SPINEN's Laravel Package for ClickUp.

282.2k](/packages/spinen-laravel-clickup)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)[resend/resend-php

Resend PHP library.

574.7M21](/packages/resend-resend-php)[crowdin/crowdin-api-client

PHP client library for Crowdin API v2

611.5M5](/packages/crowdin-crowdin-api-client)

PHPackages © 2026

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