newman / draugiem-php-sdk
Draugiem.lv API library for PHP based on Guzzle.
1.0.0
2023-01-25 10:36 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^8.0|^9.0
README
This is not the official library!
This is a minor rewrite of original api library using Guzzle client and strict typing.
Requirements
- PHP 7.4+
Installation
Require the package via Composer:
composer require newman/draugiem-php-sdk
📖 Documentation & Usage
Make an API call
Response is an implementation of Psr\Http\Message\ResponseInterface
.
$draugiemApi = new \Newman\DraugiemPhpSdk\DraugiemApi(1234, 'app key'); //$draugiemApi = new \Newman\DraugiemPhpSdk\DraugiemApi(1234, 'app key', 'user key'); $response = $draugiemApi->apiCall('authorize', ['code' => 5728195]); var_dump($response->getStatusCode()); var_dump($response->getBody()->getContents());
Set default Guzzle client options
$draugiemApi = new \Newman\DraugiemPhpSdk\DraugiemApi(1234, 'app key'); $draugiemApi->setDefaultGuzzleClientOptions([ 'timeout' => 10, 'headers' => [ 'User-Agent' => 'testing/1.0', ], ]); // make an api call
🤝 Contributing
We'll appreciate your collaboration to this package.
When making pull requests, make sure:
- All tests are passing:
composer test
- Test coverage is not reduced:
composer test-coverage
- There are no PHPStan errors:
composer phpstan
- Coding standard is followed:
composer lint
orcomposer fix-style
to automatically fix it.