Installation
Requirements
Section titled “Requirements”- PHP 8.3 or newer
- A PSR-18 HTTP client and PSR-17 factories
- A Twinfield client ID and secret from the Twinfield developer portal
Install
Section titled “Install”composer require solvebeam/twinfieldThe SDK does not ship an HTTP client. Install one you like, for example Symfony’s lightweight client with Nyholm’s PSR-7 implementation:
composer require symfony/http-client nyholm/psr7Or a pure cURL client:
composer require php-http/curl-client nyholm/psr7Twinfield::create() finds an installed client and factories automatically through php-http/discovery. You can also pass your own, see Authentication.
Optional packages
Section titled “Optional packages”| 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 |
- Let a user log in and get a refresh token.
- Create a client in your own application.
- Run the examples to see it work against your own company.