logipro / turbolead-api
Shared PSR-18 transport for Turbolead REST API clients
Package info
gitlab.logipro.com/opensource/turbolead/turbolead-api
pkg:composer/logipro/turbolead-api
Requires
- php: >=7.4
- ext-json: *
- php-http/discovery: ^1.19
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.1 || ^2.0
Requires (Dev)
- nyholm/psr7: ^1.8
- php-http/mock-client: ^1.6
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9.6
- squizlabs/php_codesniffer: ^3.10
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-11 20:27:15 UTC
README
Shared PSR-18 transport for the Turbolead REST APIs. Module clients (logipro/turbolead-core-php, logipro/system-learning-php, logipro/idcommerce-php) depend on this package and do not reimplement the JSON envelope.
Install
composer require logipro/turbolead-api
Installable from Packagist.
Requires PHP 7.4+ and a PSR-18 HTTP client plus PSR-17 factories (for example guzzlehttp/guzzle, or symfony/http-client with nyholm/psr7). Pass them through ClientOptions, or let php-http/discovery find them.
Contract
Successful body:
{ "data": {}, "meta": {} }
Error body:
{ "code": "VALIDATION_ERROR", "message": "Unprocessable Entity", "moreInfo": null, "errors": {} }
Authentication is Authorization: Bearer tlk_…. Transport::send() sends the token. Transport::sendPublic() does not (GET /api/turbolead/probe).
Usage
use Logipro\Turbolead\Client\ClientOptions;
use Logipro\Turbolead\Client\TransportFactory;
$transport = TransportFactory::create(
'tlk_prefix_secret',
'https://intranet.example',
ClientOptions::create()
->withHttpClient($httpClient)
->withRequestFactory($requestFactory)
->withStreamFactory($streamFactory)
);
$response = $transport->send('GET', '/api/user/users', ['page' => 1]);
$data = $response->getData();
$meta = $response->getMeta();
Failures implement Logipro\Turbolead\Client\Exception\TurboleadException. HTTP 422 is ValidationException and getErrors() returns array<string, list<string>>.
Contributing
Requirements: Docker and Git (PHP is not required on the host).
git clone git@gitlab.logipro.com:opensource/turbolead/turbolead-api.git
cd turbolead-api
./install
./codecheck
bin/infection
composer.lock is not committed. Infection runs as a PHAR on PHP 8.2 so its dependencies stay out of the PHP 7.4 lock.