PHPackages                             datalumo/php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. datalumo/php-sdk

ActiveLibrary[API Development](/categories/api)

datalumo/php-sdk
================

PHP SDK for the datalumo self-hosted RAG search API

0.1.0(1mo ago)04↓87%1MITPHPPHP &gt;=8.1

Since Jun 11Pushed 1mo agoCompare

[ Source](https://github.com/datalumo/php)[ Packagist](https://packagist.org/packages/datalumo/php-sdk)[ RSS](/packages/datalumo-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (5)Used By (1)

Datalumo PHP SDK
================

[](#datalumo-php-sdk)

PHP client for the Datalumo. Bearer authentication, a fully configurable base URL, and SSE streaming for chat.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- [Composer](https://getcomposer.org/)
- `guzzlehttp/guzzle ^7.8` (installed automatically)

Install
-------

[](#install)

```
composer require datalumo/php-sdk
```

Quick start
-----------

[](#quick-start)

```
use Datalumo\Client;

$client = new Client(
    apiKey:  'your_token',
    baseUrl: 'http://127.0.0.1:3000',
);

// Create an index and add an item
$client->indexes()->create(['name' => 'docs']);
$client->ingestion()->addItem('docs', [
    'id'              => 'welcome',
    'title'          => 'Refund policy',
    'searchable_text' => 'Refunds are available within 30 days of purchase.',
]);

// Or add several at once (and pass envelope options like force):
$client->ingestion()->addItems('docs', [
    ['id' => 'a', 'searchable_text' => '...'],
    ['id' => 'b', 'searchable_text' => '...'],
], ['force' => true]);

// Search through an app
$results = $client->search()->search('support-bot', [
    'query' => 'how do refunds work?',
    'k'     => 5,
]);
```

All methods return the decoded JSON response as a PHP array (or `null` for `204 No Content`).

Streaming chat
--------------

[](#streaming-chat)

The chat endpoint can stream its answer as Server-Sent Events. Use `stream()` to iterate events as they arrive, or `chat()` for a single blocking response.

```
foreach ($client->chat()->stream('support-bot', ['message' => 'Can I get a refund?']) as $event) {
    switch ($event['type']) {            // start | delta | step | done | error
        case 'delta':
            echo $event['text'];          // print tokens as they stream
            break;
        case 'done':
            echo "\n";
            break;
    }
}

// Or, non-streaming:
$answer = $client->chat()->chat('support-bot', ['message' => 'Can I get a refund?']);
echo $answer['answer'];
```

Error handling
--------------

[](#error-handling)

Every HTTP error is raised as a typed exception carrying the parsed error envelope (`{ "error": { "code", "message", "details" } }`):

```
use Datalumo\Exception\ApiException;
use Datalumo\Exception\NotFoundException;
use Datalumo\Exception\TransportException;

try {
    $client->indexes()->get('missing');
} catch (NotFoundException $e) {          // 404
    // ...
} catch (ApiException $e) {                // any other 4xx/5xx
    $e->getHttpStatus();   // e.g. 409
    $e->getErrorCode();    // e.g. "conflict"
    $e->getDetails();      // free-form details
} catch (TransportException $e) {          // connection refused, timeout, TLS, ...
    // ...
}
```

HTTP statusException400`BadRequestException`404`NotFoundException`409`ConflictException`500`ServerException`501`NotImplementedException`other ≥400`ApiException` (base)All of them extend `ApiException`, which extends `DatalumoException`. Transport-level failures throw `TransportException`. Catch `DatalumoException` to handle anything the SDK can throw.

Resources
---------

[](#resources)

Accessed via `$client->()`:

AccessorEndpoints`indexes()`create / list / get / delete indexes`ingestion()`add / list / get / delete items, batch ingest, job status`apps()`create / list / get / update / delete / restore / widget`search()`search within an app`chat()`chat (blocking) and stream (SSE)`summarize()`summarize results for a query`analytics()`record events; queries / clicks / feedback / volume / usage / system`conversations()`list / get / delete conversations`tokens()`API tokens, widget tokens, publishable keys`sync()`create / list / get / update / delete / run sync schedulesConfiguration &amp; extensibility
---------------------------------

[](#configuration--extensibility)

The constructor accepts:

ArgumentDefaultPurpose`apiKey`— (required)Bearer token`baseUrl`— (required)API base URL`timeout``30.0`Per-request timeout (seconds)`headers``[]`Extra default headers`httpClient``null`Bring your own `GuzzleHttp\ClientInterface``guzzleConfig``[]`Extra Guzzle config (e.g. `handler`, `proxy`, `verify`)The SDK is intentionally open for extension: no classes are `final`, internal helpers are `protected`, and you can inject a custom Guzzle client or middleware stack — for logging, retries, or custom auth — without forking. For example, to add a retry middleware:

```
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;

$stack = HandlerStack::create();
$stack->push(Middleware::retry(/* ... */));

$client = new Client(
    apiKey:       'your_token',
    baseUrl:      'http://127.0.0.1:3000',
    guzzleConfig: ['handler' => $stack],
);
```

Development
-----------

[](#development)

```
composer install
vendor/bin/phpunit
```

Tests use Guzzle's `MockHandler`, so they run without a live server.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Total

3

Last Release

58d ago

PHP version history (2 changes)0.2.0PHP ^8.2

0.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/66ca71465f93459010e10f39821b541f1c00c61233c48bcda0cea8a8d6fb6988?d=identicon)[jeffreyvr](/maintainers/jeffreyvr)

---

Top Contributors

[![jeffreyvr](https://avatars.githubusercontent.com/u/9550079?v=4)](https://github.com/jeffreyvr "jeffreyvr (2 commits)")

---

Tags

apisearchsdkragdatalumo

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/datalumo-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/datalumo-php-sdk/health.svg)](https://phpackages.com/packages/datalumo-php-sdk)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[resend/resend-php

Resend PHP library.

608.3M51](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M16](/packages/checkout-checkout-sdk-php)[files.com/files-php-sdk

Files.com PHP SDK

2482.9k](/packages/filescom-files-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
