{"id":34638277,"url":"https://github.com/spinen/connectwise-php-client","last_synced_at":"2025-12-24T17:12:27.913Z","repository":{"id":28532104,"uuid":"32049033","full_name":"spinen/connectwise-php-client","owner":"spinen","description":"SPINEN's PHP client for the ConnectWise API","archived":false,"fork":false,"pushed_at":"2024-04-08T15:52:25.000Z","size":4374,"stargazers_count":16,"open_issues_count":4,"forks_count":8,"subscribers_count":11,"default_branch":"develop","last_synced_at":"2025-10-23T09:54:20.586Z","etag":null,"topics":["api","api-client","client","connectwise","connectwise-manage","laravel","laravel-package","spinen"],"latest_commit_sha":null,"homepage":"http://spinen.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spinen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-03-12T00:48:02.000Z","updated_at":"2025-10-06T08:59:35.000Z","dependencies_parsed_at":"2024-04-08T17:03:56.192Z","dependency_job_id":null,"html_url":"https://github.com/spinen/connectwise-php-client","commit_stats":{"total_commits":285,"total_committers":4,"mean_commits":71.25,"dds":"0.12631578947368416","last_synced_commit":"da151505d579a5b3a4073e548aee5964f1198101"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/spinen/connectwise-php-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinen%2Fconnectwise-php-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinen%2Fconnectwise-php-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinen%2Fconnectwise-php-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinen%2Fconnectwise-php-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spinen","download_url":"https://codeload.github.com/spinen/connectwise-php-client/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spinen%2Fconnectwise-php-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28005414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","client","connectwise","connectwise-manage","laravel","laravel-package","spinen"],"created_at":"2025-12-24T17:10:54.564Z","updated_at":"2025-12-24T17:12:27.899Z","avatar_url":"https://github.com/spinen.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SPINEN's ConnectWise PHP Client\n\n[![Latest Stable Version](https://poser.pugx.org/spinen/connectwise-php-client/v/stable)](https://packagist.org/packages/spinen/connectwise-php-client)\n[![Total Downloads](https://poser.pugx.org/spinen/connectwise-php-client/downloads)](https://packagist.org/packages/spinen/connectwise-php-client)\n[![Latest Unstable Version](https://poser.pugx.org/spinen/connectwise-php-client/v/unstable)](https://packagist.org/packages/spinen/connectwise-php-client)\n[![License](https://poser.pugx.org/spinen/connectwise-php-client/license)](https://packagist.org/packages/spinen/connectwise-php-client)\n\nPHP client for the RESTful ConnectWise APIs.\n\nWe solely use [Laravel](http://www.laravel.com) for our applications, so there are some Laravel specific files that you\ncan use if you are using this client in a Laravel application. We have tried to make sure that you can use the client\noutside of Laravel, and have some documentation about it below.\n\n## Build Status\n\n| Branch | Status | Coverage | Code Quality |\n| ------ | :----: | :------: | :----------: |\n| Develop | [![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://scrutinizer-ci.com/g/spinen/connectwise-php-client/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/?branch=develop) | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/?branch=develop) |\n| 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://scrutinizer-ci.com/g/spinen/connectwise-php-client/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/?branch=master) | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/spinen/connectwise-php-client/?branch=master) |\n\n## Note about the integration\nWe are using the \"Member Impersonation\" model where you set up an integrator username \u0026 password with access to the\n\"Member API\", which makes all calls to ConnectWise performed under the permission of the user (member id) of the\napplication.\n\nWe make all of our ConnectWise users' member ID equal to their email (i.e. joe.doe@spinen.com has\na member ID of joedoe in ConnectWise) [NOTE: The \".\" was removed from joe.doe as ConnectWise does not allow periods in the\nmember ID]. By following this convention, we can infer the member ID from the logged in user's email address in our\napplications. We have included a trait that you can use on the User model that will perform the logic above.\n\nAs of 2019.3, they require a `clientId` when connecting to the API, so you will need to register for one here...\n\n[https://developer.connectwise.com/ClientID](https://developer.connectwise.com/ClientID)\n\n## Supported Actions\n\nThe client supports the standard `http verbs` plus one extra one...\n\n* `delete`\n* `get` (ConnectWise default pagination is 25 records, so unless you specify a different `pageSize`, you will get 25 records)\n* `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.)\n* `head`\n* `put`\n* `post`\n* `patch`\n\n## Models\n\nThe 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.\n\n## Relationships\n\nSome 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 \u0026 returned.  The value is stored in place of the original data, so once it is loaded it is cached.\n\n```\n$ psysh\nPsy Shell v0.8.18 (PHP 7.2.17 — cli) by Justin Hileman\n\n\u003e\u003e\u003e // Using \"$member\" object for this example\n\u003e\u003e\u003e get_class($member) // Verify that it is a \"Member\"\n=\u003e \"Spinen\\ConnectWise\\Models\\v2019_3\\System\\Member\"\n\u003e\u003e\u003e get_class($member-\u003edefaultLocation) // On load, the \"defaultLocation\" is a \"SystemLocationReference\" object\n=\u003e \"Spinen\\ConnectWise\\Models\\v2019_3\\System\\SystemLocationReference\"\n\u003e\u003e\u003e get_class($member-\u003edefaultLocation()) // Call it as a method to load the relationship\n=\u003e \"Spinen\\ConnectWise\\Models\\v2019_3\\System\\Location\"\n\u003e\u003e\u003e get_class($member-\u003edefaultLocation) // Now it is cached as a \"Location\" object\n=\u003e \"Spinen\\ConnectWise\\Models\\v2019_3\\System\\Location\"\n```\n\nThere 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]\n\n```\n$ psysh\nPsy Shell v0.8.18 (PHP 7.2.17 — cli) by Justin Hileman\n\n\u003e\u003e\u003e // Using \"$company\" object for this example\n\u003e\u003e\u003e get_class($company) // Verify that it is a \"Company\"\n=\u003e \"Spinen\\ConnectWise\\Models\\v2018_6\\Company\\Company\"\n\u003e\u003e\u003e $company-\u003e_info // Look for potential relations\n=\u003e Spinen\\ConnectWise\\Models\\v2018_6\\Company\\Metadata {#5678\n     +\"lastUpdated\": \"2019-05-20T18:12:38Z\",\n     +\"updatedBy\": \"someone\",\n     +\"dateEntered\": \"2006-06-21T16:04:59Z\",\n     +\"enteredBy\": \"someone\",\n     +\"contacts_href\": \"https://some.host/v4_6_release/apis/3.0/company/contacts?conditions=company/id=250\",\n     +\"agreements_href\": \"https://some.host/v4_6_release/apis/3.0/finance/agreements?conditions=company/id=250\",\n     +\"tickets_href\": \"https://some.host/v4_6_release/apis/3.0/service/tickets?conditions=company/id=250\",\n     +\"opportunities_href\": \"https://some.host/v4_6_release/apis/3.0/sales/opportunities?conditions=company/id=250\",\n     +\"activities_href\": \"https://some.host/v4_6_release/apis/3.0/sales/activities?conditions=company/id=250\",\n     +\"projects_href\": \"https://some.host/v4_6_release/apis/3.0/project/projects?conditions=company/id=250\",\n     +\"configurations_href\": \"https://some.host/v4_6_release/apis/3.0/company/configurations?conditions=company/id=250\",\n     +\"orders_href\": \"https://some.host/v4_6_release/apis/3.0/sales/orders?conditions=company/id=250\",\n     +\"documents_href\": \"https://some.host/v4_6_release/apis/3.0/system/documents?recordType=Company\u0026recordId=250\",\n     +\"sites_href\": \"https://some.host/v4_6_release/apis/3.0/company/companies/250/sites\",\n     +\"teams_href\": \"https://some.host/v4_6_release/apis/3.0/company/companies/250/teams\",\n     +\"reports_href\": \"https://some.host/v4_6_release/apis/3.0/company/companies/250/managementSummaryReports\",\n     +\"notes_href\": \"https://some.host/v4_6_release/apis/3.0/company/companies/250/notes\",\n   }\n\u003e\u003e\u003e isset($company-\u003eagreements) // Not loaded before the call\n=\u003e false\n\u003e\u003e\u003e $company-\u003eagreements // Client goes to get \"agreements\" from the $company-\u003e_info-\u003eagreements_fref URI\n=\u003e Spinen\\ConnectWise\\Support\\Collection {#6123\n     // Removed to make example shorter\n   }\n\u003e\u003e\u003e isset($company-\u003eagreements) // Cached \u0026 loaded for next call\n=\u003e true\n```\n\n## Install\n\nInstall the ConnectWise PHP Client:\n\n```bash\n$ composer require spinen/connectwise-php-client\n```\n\n## Laravel Configuration and Usage\n\n### For \u003e= Laravel 5.5, you are done with the installation\n\nThe package uses the [auto registration feature](https://laravel.com/docs/5.8/packages#package-discovery) of Laravel 5.\n\n### For \u003c Laravel 5.5, you have to register the Service Provider\n\n1. Add the provider to ```config/app.php```\n\n```php\n    'providers' =\u003e [\n        # other providers omitted\n        Spinen\\ConnectWise\\Laravel\\ServiceProvider::class,\n    ],\n```\n\n2. [Optional] Add the alias to ```config/app.php```\n\n```php\n    'aliases' =\u003e [\n        # other aliases omitted\n        'ConnectWise' =\u003e Spinen\\ConnectWise\\Laravel\\Facades\\ConnectWise::class,\n    ],\n```\n\n### Configuration\n\n1. Add the following to ```config/services.php```...\n\n```php\n    'connectwise' =\u003e  [\n        'client_id' =\u003e env('CW_CLIENT_ID'),\n        'company_id' =\u003e env('CW_COMPANY_ID'),\n        // Optional member id to use if there is not a logged in user\n        'default_member_id' =\u003e env('CW_DEFAULT_MEMBER_ID'),\n        'integrator' =\u003e env('CW_INTEGRATOR'),\n        'password' =\u003e env('CW_PASSWORD'),\n        'url' =\u003e env('CW_URL'),\n        // Optional version of the API models to use\n        //'version' =\u003e '' // default is the latest supported\n    ],\n```\n\n2. Add the appropriate values to your ```.env```...\n\n```bash\nCW_CLIENT_ID=\u003cthe-client-id\u003e\nCW_COMPANY_ID=\u003ccompany_id\u003e\nCW_DEFAULT_MEMBER_ID=\u003cdefault_member_id\u003e\nCW_INTEGRATOR=\u003cintegrator username\u003e\nCW_PASSWORD=\u003cintegrator password\u003e\nCW_URL=https://\u003cFQDN to ConnectWise server\u003e\n```\n\n3. 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.\n\n### Usage\n\nHere is an example of getting the system information...\n\nAs 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.\n\n```\n$ php artisan tinker\nPsy Shell v0.8.0 (PHP 7.0.14 — cli) by Justin Hileman\n\u003e\u003e\u003e Auth::loginUsingId(1); // If not useing the default member id\n=\u003e App\\User {#983\n     id: \"1\",\n     first_name: \"Joe\",\n     last_name: \"Doe\",\n     email: \"joe.doe@domain.tld\",\n     admin: \"0\",\n     created_at: \"2017-01-02 18:30:47\",\n     updated_at: \"2017-01-12 22:22:39\",\n     logged_in_at: \"2017-01-12 22:22:39\",\n     deleted_at: null,\n   }\n\u003e\u003e\u003e $cw = app('Spinen\\ConnectWise\\Api\\Client');\n=\u003e Spinen\\ConnectWise\\Api\\Client {#934}\n\u003e\u003e\u003e $info = $cw-\u003eget('system/info');\n=\u003e Spinen\\ConnectWise\\Models\\v2019_3\\System\\Info {#1008}\n\u003e\u003e\u003e $info-\u003etoArray();\n=\u003e [\n     \"version\" =\u003e \"v2016.6.43325\",\n     \"isCloud\" =\u003e false,\n     \"serverTimeZone\" =\u003e \"Eastern Standard Time\",\n   ]\n\u003e\u003e\u003e $info-\u003etoJson()\n=\u003e \"{\"version\":\"v2016.6.43325\",\"isCloud\":false,\"serverTimeZone\":\"Eastern Standard Time\"}\"\n\u003e\u003e\u003e $info-\u003eisCloud\n=\u003e false\n\u003e\u003e\u003e $info['isCloud'];\n=\u003e false\n```\n\nSame call using the facade...\n\n```\n$ php artisan tinker\nPsy Shell v0.8.0 (PHP 7.0.14 — cli) by Justin Hileman\n\u003e\u003e\u003e Auth::loginUsingId(1);  // If not useing the default member id\n=\u003e App\\User {#983\n     id: \"1\",\n     first_name: \"Joe\",\n     last_name: \"Doe\",\n     email: \"joe.doe@domain.tld\",\n     admin: \"0\",\n     created_at: \"2017-01-02 18:30:47\",\n     updated_at: \"2017-01-12 22:22:39\",\n     logged_in_at: \"2017-01-12 22:22:39\",\n     deleted_at: null,\n   }\n\u003e\u003e\u003e ConnectWise::get('system/info');\n=\u003e Spinen\\ConnectWise\\Models\\v2019_3\\System\\Info {#1005}\n\u003e\u003e\u003e ConnectWise::get('system/info')-\u003etoArray();\n=\u003e [\n        \"version\" =\u003e \"v2018.6.59996\",\n        \"isCloud\" =\u003e false,\n        \"serverTimeZone\" =\u003e \"Eastern Standard Time\",\n        \"licenseBits\" =\u003e [\n          // ... All of the properties\n        ],\n        \"cloudRegion\" =\u003e \"NA\",\n      ]\n\u003e\u003e\u003e ConnectWise::get('system/info')-\u003etoJson();\n=\u003e \"{\"version\":\"v2018.6.59996\",...}\"\n\u003e\u003e\u003e ConnectWise::get('system/info')-\u003eisCloud;\n=\u003e false\n\u003e\u003e\u003e ConnectWise::get('system/info')['isCloud'];\n=\u003e false\n\u003e\u003e\u003e\n```\n\n## Non-Laravel Usage\n\nTo use the client outside of Laravel, you just need to new-up the objects...\n\n```\n$ psysh\nPsy Shell v0.8.18 (PHP 7.2.17 — cli) by Justin Hileman\n\n\u003e\u003e\u003e // New-up objects\n\u003e\u003e\u003e $token = (new Spinen\\ConnectWise\\Api\\Token())-\u003esetCompanyId('\u003ccompany_id\u003e')-\u003esetMemberId('\u003cmember_id\u003e');\n=\u003e Spinen\\ConnectWise\\Api\\Token {#208}\n\u003e\u003e\u003e $guzzle = new GuzzleHttp\\Client();\n=\u003e GuzzleHttp\\Client {#196}\n\u003e\u003e\u003e $resolver = new Spinen\\ConnectWise\\Support\\ModelResolver();\n=\u003e Spinen\\ConnectWise\\Support\\ModelResolver {#201}\n\u003e\u003e\u003e $client = (new Spinen\\ConnectWise\\Api\\Client($token, $guzzle, $resolver))-\u003esetClientId('\u003cthe-client-id\u003e')-\u003esetIntegrator('\u003cintegrator\u003e')-\u003esetPassword('\u003cpassword\u003e')-\u003esetUrl('https://\u003cdomain.tld\u003e');\n=\u003e Spinen\\ConnectWise\\Api\\Client {#231}\n\u003e\u003e\u003e $info = $client-\u003eget('system/info');                                                                                                                     =\u003e Spinen\\ConnectWise\\Models\\v2019_3\\System\\Info {#237}\n\u003e\u003e\u003e $info-\u003etoArray();\n=\u003e [\n     \"version\" =\u003e \"v2018.6.59996\",\n     \"isCloud\" =\u003e false,\n     \"serverTimeZone\" =\u003e \"Eastern Standard Time\",\n     \"licenseBits\" =\u003e [\n       // ... All of the properties\n     ],\n     \"cloudRegion\" =\u003e \"NA\",\n   ]\n\u003e\u003e\u003e // Set client to use different version\n\u003e\u003e\u003e $client-\u003esetVersion('2019.1')\n=\u003e Spinen\\ConnectWise\\Api\\Client {#231}\n\u003e\u003e\u003e $info = $client-\u003eget('system/info');\n\u003e\u003e\u003e /// NOTE: the version in the namespace\n=\u003e Spinen\\ConnectWise\\Models\\v2019_1\\System\\Info {#235}\n```\n\n## Supported API Model Versions\n\nYou can specify the version of the models you want in 1 of 3 ways...\n\n1. The 4th parameter in the `Client` constructor\n2. Calling the `setVersion` method on the `client` object\n3. [Laravel only] Setting the `version` property in the config\n\nThe supported versions are:\n\n* 2018.4\n* 2018.5\n* 2018.6\n* 2019.1\n* 2019.2\n* 2019.3\n* 2019.4\n* 2019.5 `(default)`\n\nYou can see the differences of the models by looking at the `casts` property on the individual `models` in `src/Models/\u003cversion\u003e` directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspinen%2Fconnectwise-php-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspinen%2Fconnectwise-php-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspinen%2Fconnectwise-php-client/lists"}