Search by

logipro / turbolead-core-php

fredlogipro

PHP client for the Turbolead core REST API (`/api/turbolead` and `/api/user`)

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

This package is not auto-updated.

Last update: 2026-11-11 20:32:30 UTC


README

PHP client for the Turbolead core REST API (/api/turbolead and /api/user).

  • Composer package: logipro/turbolead-core-php
  • Namespace: Logipro\Turbolead\Core\
  • PHP: >=7.4 (transport via logipro/turbolead-api)

Installation

composer require logipro/turbolead-core-php

Installable from Packagist. Requires PHP 7.4+ and a PSR-18 HTTP client. HTTP transport comes from logipro/turbolead-api.

Quick start

<?php

declare(strict_types=1);

use Logipro\Turbolead\Core\TurboleadClient;

$client = TurboleadClient::create(
  'tlk_prefix_secret',
  'https://intranet.example.com'
);

// Public probe (no Authorization header)
$status = $client->probe()->show()->getStatus();

// Authenticated routes
$modules = $client->modules()->list()->getModules();
$page = $client->users()->list(1, 20);

foreach ($page->getUsers() as $user) {
    echo $user->getLogin(), ' ', $user->getEmail(), PHP_EOL;
}

echo $page->getMeta()->getPage(), ' / ', $page->getMeta()->getTotal(), PHP_EOL;

Create a user:

use Logipro\Turbolead\Core\Dto\CreateUserRequest;

$created = $client->users()->create(new CreateUserRequest(
    'ada.lovelace',
    null,
    'Ada',
    'Lovelace',
    'ada@example.com'
));

echo $created->getId(), PHP_EOL;

API tokens:

use Logipro\Turbolead\Core\Dto\CreateApiTokenRequest;

$issued = $client->apiTokens()->create(new CreateApiTokenRequest('CI automation', [109, 110]));
echo $issued->getToken(); // shown once

Resources

AccessorMethods
probe()show(), secured()
modules()list()
users()list(), get(), create(), addGroup(), removeGroup(), addDroit(), removeDroit(), addGroupDroit(), removeGroupDroit(), setState()
apiTokens()list(), create(), revoke()

HTTP is handled by logipro/turbolead-api. Inject a PSR-18 client for tests:

use Http\Mock\Client as MockHttpClient;
use Logipro\Turbolead\Client\ClientOptions;
use Nyholm\Psr7\Factory\Psr17Factory;

$psr17 = new Psr17Factory();
$options = ClientOptions::create()
    ->withHttpClient(new MockHttpClient($psr17))
    ->withRequestFactory($psr17)
    ->withStreamFactory($psr17);

$client = TurboleadClient::create('tlk_prefix_secret', 'https://intranet.example.com', $options);

Errors throw Logipro\Turbolead\Client\Exception\* (UnauthorizedException, ValidationException with getErrors(), etc.).

Contract

OpenAPI snapshot: docs/api/openapi.yaml.

Quality

Docker and Docker Compose are required on the host (no local php binary needed).

./install          # composer install in Docker
./codecheck        # phpcbf, phpcs, phpstan, phpunit (unit)
bin/infection      # mutation testing
bin/integration    # integration tests (local PHP built-in server fixture)

Demo nginx stack (optional): ./start / ./stop — default port 35081, project turbolead-core-php.

git clone git@gitlab.logipro.com:opensource/turbolead/turbolead-core-php.git

composer.lock is not committed. To develop against a local checkout of the transport:

composer config repositories.turbolead-api path ../turbolead-api

License

MIT