PHPackages                             minhyung/openobserve - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. minhyung/openobserve

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

minhyung/openobserve
====================

A library for OpenObserve

0.1.1(1mo ago)0161MITPHPPHP ^8.3CI passing

Since May 28Pushed 1mo agoCompare

[ Source](https://github.com/overworks/php-openobserve)[ Packagist](https://packagist.org/packages/minhyung/openobserve)[ RSS](/packages/minhyung-openobserve/feed)WikiDiscussions 0.x Synced 1w ago

READMEChangelogDependencies (6)Versions (3)Used By (1)

php-openobserve
===============

[](#php-openobserve)

[![CI](https://github.com/overworks/php-openobserve/actions/workflows/ci.yml/badge.svg)](https://github.com/overworks/php-openobserve/actions/workflows/ci.yml)[![Latest Version](https://camo.githubusercontent.com/38ee4def84951e82e941e0be9f1a5aebb0e4f03bf2ef2fe054ec3a3a9a779e38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696e6879756e672f6f70656e6f6273657276652e737667)](https://packagist.org/packages/minhyung/openobserve)[![PHP Version](https://camo.githubusercontent.com/eb6a8e618e0a249da82d8adc93639583c2f31a0c043646cdfb21e02f6079e94d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d696e6879756e672f6f70656e6f6273657276652e737667)](https://packagist.org/packages/minhyung/openobserve)[![License](https://camo.githubusercontent.com/1bb794f752e30899588b6a858f90d445db62e14d24e144cf04bc649de1ff3276/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d696e6879756e672f6f70656e6f6273657276652e737667)](LICENSE)

A PHP client for [OpenObserve](https://openobserve.ai/). Ships logs/metrics/traces, runs SQL searches, manages streams, and exposes the administrative APIs through a small, typed surface built on PSR-18 / PSR-17.

Installation
------------

[](#installation)

```
composer require minhyung/openobserve
```

The library uses PSR-18 / PSR-17 HTTP abstractions and discovers an implementation at runtime via `php-http/discovery`. If your project does not already ship one, install Guzzle (or any other implementation) alongside:

```
composer require guzzlehttp/guzzle
```

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

[](#quick-start)

### Email + password

[](#email--password)

```
use Minhyung\OpenObserve\Client;

$client = new Client(
    baseUrl: 'http://localhost:5080',
    email: 'root@example.com',
    password: 'Complexpass#123',
    organization: 'default',
);

$client->logs()->json('app-logs', [
    ['level' => 'info', 'message' => 'hello, world'],
]);
```

### Pre-encoded token

[](#pre-encoded-token)

OpenObserve exposes a "Basic auth token" in the UI — a base64 blob of `email:password`you can copy without re-encoding. Use `Client::withToken()`:

```
$client = Client::withToken(
    baseUrl: 'http://localhost:5080',
    token: 'YWRtaW46Q29tcGxleHBhc3MjMTIz',
    organization: 'default',
);
```

The bound `organization` is the default for every resource accessor; pass an override per call (e.g. `$client->logs('other-org')`) when you need to target a different one.

Log ingestion
-------------

[](#log-ingestion)

Three endpoints are exposed via the `Logs` resource:

```
// _json: array of records into one stream
$client->logs()->json('app-logs', [
    ['_timestamp' => 1_700_000_000_000_000, 'level' => 'info', 'message' => 'one'],
    ['_timestamp' => 1_700_000_001_000_000, 'level' => 'warn', 'message' => 'two'],
]);

// _multi: same shape but sent as NDJSON
$client->logs()->multi('app-logs', $records);

// _bulk: Elasticsearch-compatible, target many streams at once
$client->logs()->bulk([
    'app-logs' => [['level' => 'info', 'message' => 'hi']],
    'audit'    => [['action' => 'login', 'user' => 'alice']],
]);
```

OpenTelemetry (OTLP/JSON)
-------------------------

[](#opentelemetry-otlpjson)

```
$client->otlp()->logs([
    'resourceLogs' => [/* OTLP/JSON */],
], streamName: 'app-logs');

$client->otlp()->metrics(['resourceMetrics' => [/* ... */]]);
$client->otlp()->traces(['resourceSpans' => [/* ... */]]);
```

Search
------

[](#search)

```
$result = $client->search()->sql(
    sql: 'SELECT * FROM "app-logs" WHERE level = \'error\'',
    startTime: 1_700_000_000_000_000, // unix microseconds
    endTime:   1_700_000_060_000_000,
    size: 100,
);

foreach ($result['hits'] ?? [] as $row) {
    // ...
}
```

Streams management
------------------

[](#streams-management)

```
use Minhyung\OpenObserve\Resource\Streams;

$client->streams()->list(Streams::TYPE_LOGS, fetchSchema: true);
$client->streams()->get('app-logs');
$client->streams()->updateSettings('app-logs', [
    'data_retention' => 30,
    'full_text_search_keys' => ['set' => ['body']],
]);
$client->streams()->delete('app-logs', Streams::TYPE_LOGS, deleteAll: true);
```

Administrative resources
------------------------

[](#administrative-resources)

All follow the same CRUD shape: `list`, `get`, `create`, `update`, `delete`.

```
$client->functions()->create([
    'function' => 'function(row) return row end',
    'order' => 1,
]);

$client->users()->create([
    'email' => 'admin@example.com',
    'first_name' => 'ming', 'last_name' => 'xing',
    'password' => 'complex#pass',
    'role' => 'admin',
]);

$client->alerts()->setEnabled('high-error-rate', false);
$client->alerts()->trigger('high-error-rate');

$client->dashboards()->list(folder: 'production');

$client->organizations()->list();          // server-global
$client->organizations()->summary('acme'); // org-scoped stats
```

Monolog integration
-------------------

[](#monolog-integration)

```
use Minhyung\OpenObserve\Monolog\Handler;
use Monolog\Level;
use Monolog\Logger;

$logger = new Logger('app');
$logger->pushHandler(new Handler($client, stream: 'app-logs', level: Level::Info));

$logger->info('hello world', ['user_id' => 42]);
```

`handleBatch()` is implemented so Monolog's buffering handlers (e.g. `BufferHandler`, `FingersCrossedHandler`) send one HTTP request per flush.

Escape hatch
------------

[](#escape-hatch)

For endpoints not yet covered by a typed resource — or OpenObserve deployments whose URL shapes diverge from this library's defaults — drop down to the raw HTTP layer:

```
$client->request('POST', '/api/default/_settings', ['retention' => 30]);
$client->requestRaw('POST', '/api/upload', "row1\nrow2\n", 'text/csv');
```

Both apply the configured base URL and Authorization header, decode JSON responses, and surface non-2xx responses as exceptions.

Errors
------

[](#errors)

All library exceptions implement `Minhyung\OpenObserve\Exception\OpenObserveException`, so you can catch them uniformly:

ClassTrigger`AuthenticationException`HTTP 401 / 403`ApiException`Any other 4xx / 5xx, with `getStatusCode()` and `getResponseBody()``TransportException`PSR-18 client failure (network error, DNS, etc.)```
use Minhyung\OpenObserve\Exception\OpenObserveException;

try {
    $client->logs()->json('app-logs', $records);
} catch (OpenObserveException $e) {
    // logging, retry, etc.
}
```

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

[](#requirements)

- PHP 8.3+
- A PSR-18 HTTP client and PSR-17 message factories (autodiscovered via `php-http/discovery`)

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

[](#development)

```
composer install
composer test
```

### Integration tests (optional)

[](#integration-tests-optional)

A handful of integration tests live in `tests/Integration/`. They skip by default and only run when you point them at a real OpenObserve instance through environment variables:

```
OPENOBSERVE_URL=http://localhost:5080 \
OPENOBSERVE_EMAIL=root@example.com \
OPENOBSERVE_PASSWORD='Complexpass#123' \
  composer test:integration
```

Alternatively, copy `phpunit.xml.dist` to `phpunit.xml` (gitignored) and set the `` values there.

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance89

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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 ~0 days

Total

3

Last Release

58d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/381cd0165a6aa9f238950dc1ae39f15a2b01a3dc33c111cd0fc1b12ab4259100?d=identicon)[lostland](/maintainers/lostland)

---

Top Contributors

[![overworks](https://avatars.githubusercontent.com/u/2780002?v=4)](https://github.com/overworks "overworks (27 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/minhyung-openobserve/health.svg)

```
[![Health](https://phpackages.com/badges/minhyung-openobserve/health.svg)](https://phpackages.com/packages/minhyung-openobserve)
```

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36789.4k2](/packages/telnyx-telnyx-php)[anthropic-ai/sdk

Anthropic PHP SDK

163583.3k20](/packages/anthropic-ai-sdk)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k28.0M326](/packages/openai-php-client)[deeplcom/deepl-php

Official DeepL API Client Library

2577.3M120](/packages/deeplcom-deepl-php)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9067.8k](/packages/n1ebieski-ksef-php-client)[trycourier/courier

Courier PHP SDK

15660.9k](/packages/trycourier-courier)

PHPackages © 2026

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