PHPackages                             logseal/logseal-php - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. logseal/logseal-php

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

logseal/logseal-php
===================

Official PHP SDK for LogSeal — Audit logging for B2B SaaS

00PHP

Since Mar 6Pushed 3mo agoCompare

[ Source](https://github.com/LogSeal/logseal-php)[ Packagist](https://packagist.org/packages/logseal/logseal-php)[ RSS](/packages/logseal-logseal-php/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

logseal-php
===========

[](#logseal-php)

Official PHP SDK for [LogSeal](https://logseal.io) — Audit logging for B2B SaaS.

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

[](#installation)

```
composer require logseal/logseal-php
```

Quick Start
-----------

[](#quick-start)

```
use LogSeal\LogSeal;

$client = new LogSeal('sk_test_...');

// Emit an event (batched)
$client->emit([
    'action' => 'document.published',
    'organization_id' => 'org_acme',
    'actor' => [
        'id' => 'user_123',
        'name' => 'Jane Smith',
        'email' => 'jane@acme.com',
    ],
    'targets' => [[
        'type' => 'document',
        'id' => 'doc_456',
        'name' => 'Q3 Report',
    ]],
    'metadata' => [
        'previous_status' => 'draft',
    ],
]);

// Emit and wait for confirmation
$event = $client->emitSync([
    'action' => 'user.deleted',
    'organization_id' => 'org_acme',
    'actor' => ['id' => 'admin_1'],
    'targets' => [['type' => 'user', 'id' => 'user_123']],
]);
echo "Event ID: " . $event['id'] . "\n";

// Flush remaining events before exit
$client->shutdown();
```

Configuration
-------------

[](#configuration)

```
$client = new LogSeal('sk_live_...', [
    'base_url' => 'https://api.logseal.io', // Optional override
    'batch_size' => 100,                     // Events to buffer before auto-flushing
    'max_retries' => 3,                      // Retry attempts on 429 / 5xx responses
    'timeout' => 30,                         // HTTP timeout in seconds
]);
```

Querying Events
---------------

[](#querying-events)

```
// Paginated list
$page = $client->events->list([
    'organization_id' => 'org_acme',
    'action' => 'document.published',
    'limit' => 50,
]);

foreach ($page['data'] as $event) {
    echo $event['action'] . ' by ' . $event['actor']['name'] . "\n";
}

// Auto-paginate through all results (Generator)
foreach ($client->events->listAll(['organization_id' => 'org_acme']) as $event) {
    echo $event['action'] . "\n";
}
```

Organizations
-------------

[](#organizations)

```
$orgs = $client->organizations->list();
$org = $client->organizations->create('acme', 'Acme Corp');
$org = $client->organizations->get('org_123');
```

Event Schemas
-------------

[](#event-schemas)

```
$schemas = $client->schemas->list();
$schema = $client->schemas->create('document.updated', 'Fired when a document is modified', ['document']);
$schema = $client->schemas->update('sch_123', ['description' => 'Updated desc']);
$client->schemas->delete('sch_123');
```

Viewer Tokens
-------------

[](#viewer-tokens)

```
$token = $client->viewerTokens->create('org_acme', 3600);
// Pass $token['token'] to your frontend for the embeddable viewer
```

Webhooks
--------

[](#webhooks)

```
$webhooks = $client->webhooks->list();
$webhook = $client->webhooks->create('https://example.com/webhooks/logseal', null, ['*']);
echo "Secret: " . $webhook['secret'] . "\n"; // Only returned on creation

$client->webhooks->update('whk_123', ['enabled' => false]);
$client->webhooks->delete('whk_123');
```

Exports
-------

[](#exports)

```
$export = $client->exports->create('org_acme', 'csv', ['after' => '2024-01-01']);

// Poll until complete
$completed = $client->exports->poll($export['id'], intervalSeconds: 1, timeoutSeconds: 120);
echo "Download: " . $completed['download_url'] . "\n";
```

Verification
------------

[](#verification)

```
$result = $client->events->verify('org_acme');
echo $result['status']; // "valid", "broken", or "tampered"
```

Error Handling
--------------

[](#error-handling)

```
use LogSeal\Exception\LogSealException;

try {
    $client->emitSync([...]);
} catch (LogSealException $e) {
    echo "[{$e->type}] {$e->code}: {$e->getMessage()}\n";
    echo "HTTP status: {$e->statusCode}\n";
}
```

All API errors are thrown as `LogSealException`:

PropertyDescription`$type`Error category (`authentication_error`, `validation_error`, etc.)`$errorCode`Machine-readable code (`invalid_api_key`, `missing_required_field`, etc.)`getMessage()`Human-readable description`$param`Request parameter that caused the error (if applicable)`$statusCode`HTTP status codeRequirements
------------

[](#requirements)

- PHP 8.1+
- Guzzle 7.x

License
-------

[](#license)

MIT

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance53

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/71b6a14555d887c493240a073e519375a891f2e7d3c09e7ec1b02510ea1b1e38?d=identicon)[logseal](/maintainers/logseal)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B10.8k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1938.5M261](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2326.5M315](/packages/open-telemetry-sdk)[illuminated/console-logger

Logging and Notifications for Laravel Console Commands.

8676.7k](/packages/illuminated-console-logger)[relaxart/monolog-docker-handler

Docker handler for monolog

1442.6k](/packages/relaxart-monolog-docker-handler)

PHPackages © 2026

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