worksome / sdk
An object-oriented PHP wrapper for the Worksome API
Fund package maintenance!
worksome
Installs: 152 545
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 8
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- php-http/client-common: ^2.5
- php-http/discovery: ^1.14.3
- php-http/httplug: ^2.3
- php-http/multipart-stream-builder: ^1.2
- psr/http-client-implementation: ^1.0
- psr/http-factory-implementation: ^1.0
- psr/http-message: ^1.1||^2.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.5
- guzzlehttp/psr7: ^2.4.1
- http-interop/http-factory-guzzle: ^1.2
- pestphp/pest: ^2.0
- php-http/mock-client: ^1.5
- php-http/vcr-plugin: ^1.2
- phpstan/phpstan: ^1.8.6
- symfony/var-dumper: ^6.0
- worksome/coding-style: ^2.5
README
An object-oriented PHP wrapper for the Worksome API
Requirements
- PHP >= 8.2
- A PSR-17 implementation
- A PSR-18 implementation
Install
Via Composer
composer require worksome/sdk guzzlehttp/guzzle:^7.5 http-interop/http-factory-guzzle:^1.2
We are decoupled from any HTTP messaging client with help by HTTPlug.
Usage
Basic usage
// Include the Composer autoloader require_once __DIR__ . '/vendor/autoload.php'; $client = new \Worksome\Sdk\Client(); $repositories = $client->graph()->execute(<<<GQL query { profile { name email } } >>>);
Authentication
The Worksome SDK supports authenticating through an API token.
$client = new \Worksome\Sdk\Client(); $client->authenticate($apiToken);
Using a different HTTP client
Thanks to HTTPlug, we support the use of many HTTP clients. For example, to use the Symfony HTTP Client, first install the client and PSR-7 implementation.
composer require worksome/sdk symfony/http-client nyholm/psr7
Next, set up the Worksome client with this HTTP client:
$client = \Worksome\SDK\Client::createWithHttpClient( new \Symfony\Component\HttpClient\HttplugClient() );
Alternatively, you can inject an HTTP client through the Client
constructor.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
composer test
To update the test snapshots, set the WORKSOME_LOCAL_API_URL
and WORKSOME_LOCAL_API_TOKEN
environment variables, and
then run composer update:snapshots
.
Credits
License
The MIT License (MIT). Please see License File for more information.