Download the PHP package tmoldri/gateway-php-sdk without Composer
On this page you can find all versions of the php package tmoldri/gateway-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tmoldri/gateway-php-sdk
More information about tmoldri/gateway-php-sdk
Files in tmoldri/gateway-php-sdk
Package gateway-php-sdk
Short Description Client for Dokobit Gateway API
License MIT
Homepage https://www.dokobit.com
Informations about the package gateway-php-sdk
Dokobit Gateway PHP Client
This library makes it easier to integrate Dokobit Gateway API in PHP applications by wrapping all of the Gateway API calls and responses in PHP objects.
How to start?
-
Instantiate a client object:
If you want to log requests, just pass a PSR-3
LoggerInterface
compatible logger (such as a Monolog instance) as the second parameter to thecreate()
method, like this: -
Use the client instantiated above to make the desired API calls. To do that, instantiate a respective request object and pass it to the
get()
method of the client. For example, to upload a file to Gateway:The client performs an HTTP request and returns a result object, which has getters for all response fields. Should the request fail for any reason, an exception will be thrown, which should help you debug the issue.
The request (query) and response (result) classes closely mirror the API calls, which are documented at https://gateway-sandbox.dokobit.com/api/doc.
To make downloading of signed files more convenient, the Client
class also provides the downloadFile()
method. To download a signed file, just call this method like this:
Note: this method will append your access token to the URL automatically, so you can pass it the URLs you receive from the Gateway's postbacks in their verbatim form, without any changes. The same method can also be used to download arbitrary files from other locations, if necessary. Should you want to do that, just pass false
as the third argument to avoid appending the access token, like this:
For further code usage examples, please check integration tests under tests/Integration
.
Debugging
To dig more into occured error use following methods:
echo (string) $exception->getMessage()
echo (string) $exception->getPrevious()->getResponse()
var_dump( $exception->getResponseData() )
These methods are available on all exception classes except UnexpectedError
and QueryValidator
.
Develop
Whole testsuite including integrational tests
phpunit
Don't forget to define SANDBOX_API_KEY
in your phpunit.xml.
Running unit tests only:
phpunit --testsuite=Unit
Running integrational tests only:
phpunit --testsuite=Integration
Running single testcase:
phpunit tests/Integration/CheckTest.php
All versions of gateway-php-sdk with dependencies
guzzlehttp/guzzle Version ^7.0.1
symfony/validator Version ~3.4|~4.4|~5.2
symfony/intl Version ^5.2