Skip to content

Installation

Terminal window
composer require solvebeam/twinfield

The SDK does not ship an HTTP client. Install one you like, for example Symfony’s lightweight client with Nyholm’s PSR-7 implementation:

Terminal window
composer require symfony/http-client nyholm/psr7

Or a pure cURL client:

Terminal window
composer require php-http/curl-client nyholm/psr7

Twinfield::create() finds an installed client and factories automatically through php-http/discovery. You can also pass your own, see Authentication.

Package For
symfony/cache A PSR-6 cache for access tokens
monolog/monolog PSR-3 logging of HTTP requests and responses
php-http/logger-plugin Logging HTTP traffic (needs a PSR-3 logger)
php-http/message Message formatters, such as FullHttpMessageFormatter for complete request and response logging
  1. Let a user log in and get a refresh token.
  2. Create a client in your own application.
  3. Run the examples to see it work against your own company.