An object-oriented PHP wrapper for the Worksome API
- PHP >= 8.2
- A PSR-17 implementation
- A PSR-18 implementation
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.
// Include the Composer autoloader
require_once __DIR__ . '/vendor/autoload.php';
$client = new \Worksome\Sdk\Client();
$repositories = $client->graph()->execute(<<<GQL
query {
profile {
name
email
}
}
>>>);
The Worksome SDK supports authenticating through an API token.
$client = new \Worksome\Sdk\Client();
$client->authenticate($apiToken);
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.
Please see CHANGELOG for more information on what has changed recently.
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
.
The MIT License (MIT). Please see License File for more information.