Search by

logipro / turbolead-api

fredlogipro

Shared PSR-18 transport for Turbolead REST API clients

v0.1.0 2026-11-11 10:47 UTC

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.

License

MIT