acadea / connectwise-php
An extensible Connectwise API client for PHP / Laravel.
Fund package maintenance!
Patreon
Requires
- php: >=7.2
- guzzlehttp/guzzle: ^6.3
- illuminate/support: ~5.3|~6.0
Requires (Dev)
- orchestra/testbench: ^4.1
- phpunit/phpunit: ^8.2
- symfony/var-dumper: ^4.3
This package is auto-updated.
Last update: 2024-11-08 18:39:48 UTC
README
Lightweight and Extensible Connectwise PHP client for Laravel 6.
Installation
You can install the package via composer:
composer require acadea/connectwise-php
Add the following env variable to .env
CW_COMPANY_ID= CW_PRIVATEKEY= CW_PUBLICKEY= # e.g https://api-au.myconnectwise.net/v4_6_release/apis/3.0/ CW_API_VERSION_BASEURL= # you can find this at api addr : /v4_6_release/apis/3.0/system/info/locations CW_HOMEOFFICE_LOCATION= CW_CLIENT_ID=
Usage
Easily use the API client. The request method returns a laravel Collection object.
ConnectwiseClient::request('get', 'company/companies'); ConnectwiseClient::request('get', 'company/companies/1'); ConnectwiseClient::request('post', 'company/companies', $payloadArray); ConnectwiseClient::request('patch', 'company/companies/1', $payloadArray); ConnectwiseClient::request('delete', 'company/companies/1');
Or use the Connectwise Class. Conveniently preloaded with 'get', 'create', 'update', 'find', 'delete' and 'count' methods
$cw = new Connectwise('company/companies'); $collection = $cw->get([ 'conditions'=> "identifier='XYZTestCompany'" ]) $collection = $cw->update( $id, [ [ 'op' => 'replace', 'path' => 'phoneNumber', 'value' => '054684321', ], [ 'op' => 'replace', 'path' => 'city', 'value' => 'heya', ], ] $collection = $cw->delete($id); $collection = $cw->find($id); $int = $cw->count($filter);
Extends the Connectwise class to create your own endpoint client
Make sure to include the uri property to customise the endpoint.
use Acadea\Connectwise; class Company extends Connectwise { protected $uri = "company/companies" public function getInvoices() { // .... } }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email hello@acadea.com.au instead of using the issue tracker.
Credits
About us
Acadea is a technology-focused company based in Perth, Western Australia. Our primary focus is on web development and software integrations! On top of that we also teach people about technology and programming.
Visit our Website
Contact us: hello@acadea.com.au
License
The MIT License (MIT). Please see License File for more information.