Download the PHP package rocketfellows/tinkoff-invest-v1-rest-client without Composer
On this page you can find all versions of the php package rocketfellows/tinkoff-invest-v1-rest-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package tinkoff-invest-v1-rest-client
Tinkoff Invest V1 rest client
This component implement's wrapper over guzzle http client for sending request to Tinkoff Invest V1.
Consist of:
- \rocketfellows\TinkoffInvestV1RestClient\Client - intended for direct sending of requests
- \rocketfellows\TinkoffInvestV1RestClient\ClientConfig - client configuration
Installation
Client config
ClientConfig contains:
- serverUrl - which is common Tinkoff Invest V1 url, for example https://invest-public-api.tinkoff.ru/rest
- accessToken - Tinkoff Invest V1 access token which can be generated through the account settings of the Tinkoff Investments application
ClientConfig can be configured through DI from your environment params. For example: for test environment of your application you can set serverUrl with Tinkoff Invest V1 sandbox, accessToken - with generated from Tinkoff Investments application for sandbox.
Client
Client interface:
Where $serviceName for example InstrumentsService and $serviceMethod for example GetDividends. Full list of available Tinkoff Invest V1 services and methods here https://tinkoff.github.io/investAPI/swagger-ui/
Interface exceptions
- \rocketfellows\TinkoffInvestV1RestClient\exceptions\request\ServerException - exception when a server error is encountered (5xx codes)
- \rocketfellows\TinkoffInvestV1RestClient\exceptions\request\ClientException - exception when a client error is encountered (4xx codes)
- \rocketfellows\TinkoffInvestV1RestClient\exceptions\request\HttpClientException - exception for other errors
Both ServerException and ClientException extends \rocketfellows\TinkoffInvestV1RestClient\exceptions\request\BadResponseException which holds server error response data:
- \rocketfellows\TinkoffInvestV1RestClient\exceptions\request\BadResponseException::getErrorCode
- \rocketfellows\TinkoffInvestV1RestClient\exceptions\request\BadResponseException::getErrorMessage
- \rocketfellows\TinkoffInvestV1RestClient\exceptions\request\BadResponseException::getErrorDescription
Server error data response example:
Component dependencies
"guzzlehttp/guzzle": "7.4.3" - https://github.com/guzzle/guzzle
Usage example
Contributing
Welcome to pull requests. If there is a major changes, first please open an issue for discussion.
Please make sure to update tests as appropriate.