PHPackages                             ditliti/laravel-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. ditliti/laravel-sdk

ActiveLibrary

ditliti/laravel-sdk
===================

Official Laravel exception reporter SDK for Ditliti (self-hosted error tracking, tracing, replays, and profiling ingestion).

v0.1.2(1mo ago)00MITPHPPHP ^8.1

Since Jul 15Pushed 1mo agoCompare

[ Source](https://github.com/kangartha/ditliti-laravel-sdk)[ Packagist](https://packagist.org/packages/ditliti/laravel-sdk)[ Docs](https://github.com/kangartha/inspectora/tree/main/sdk/php-laravel)[ RSS](/packages/ditliti-laravel-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

ditliti/laravel-sdk
===================

[](#ditlitilaravel-sdk)

Official Laravel SDK for [Ditliti](https://github.com/kangartha/inspectora) - error tracking, tracing, session replay, and profiling ingestion.

This SDK talks to a **self-hosted** Ditliti instance (`ingestion-api`). It does not connect to any managed/hosted service - point it at your own deployment's ingestion URL.

Install
-------

[](#install)

```
mkdir -p .ditliti/packages
curl -fsSL https://github.com/kangartha/inspectora/releases/download/sdk-v0.1.2/ditliti-php-laravel-0.1.2.zip -o .ditliti/packages/ditliti-laravel-sdk.zip
composer config repositories.ditliti artifact "$(pwd)/.ditliti/packages"
composer require ditliti/laravel-sdk:0.1.2
```

The artifact repository is the canonical fallback until Packagist confirms publication.

`Ditliti\Laravel\DitlitiServiceProvider` auto-registers via Laravel package discovery.

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

[](#configuration)

Add to `config/ditliti.php` (or set directly via `.env` + `config()` calls):

```
return [
    'endpoint' => env('DITLITI_ENDPOINT', 'http://localhost:8305'),
    'api_key' => env('DITLITI_API_KEY'),
    'project_id' => env('DITLITI_PROJECT_ID'),
];
```

Once registered, unhandled exceptions are reported automatically via Laravel's exception handler `reportable()` hook.

Manual usage
------------

[](#manual-usage)

```
use Ditliti\Laravel\DitlitiClient;

$client = app(DitlitiClient::class);

try {
    riskyOperation();
} catch (\Throwable $e) {
    $client->report($e, ['extra' => 'context']);
}
```

API
---

[](#api)

- `DitlitiClient::report(Throwable $exception, array $context = [], array $options = [])`
- `DitlitiClient::sendEnvelope(array $envelope)` - low-level batch submit.
- `DitlitiClient::captureReplaySegment(float $durationMs, array $events, array $options = [])`
- `DitlitiClient::captureProfile(int $durationMs, array $samples, array $options = [])`
- `DitlitiClient::withTrace(?string $incomingTraceparent = null): self`, `getTraceparent()`, `startSpan(...)` - see Distributed tracing below.

Distributed tracing
-------------------

[](#distributed-tracing)

Generates real W3C `traceparent` () trace context, so a trace can be propagated across service/microservice boundaries instead of staying siloed per project. `DitlitiClient` is immutable (all constructor properties are `readonly`), so `withTrace()` returns a **new** client instance carrying the trace rather than mutating the existing one - in a middleware, rebind it into the container for the rest of the request:

```
// app/Http/Middleware/ContinueDitlitiTrace.php
public function handle(Request $request, Closure $next)
{
    $client = app(DitlitiClient::class)->withTrace($request->header('traceparent'));
    app()->instance(DitlitiClient::class, $client);

    return $next($request);
}
```

```
// Service A: start a trace and call Service B, forwarding the header.
$client = $client->withTrace();
Http::withHeaders(['traceparent' => $client->getTraceparent()])->get($serviceBUrl);

$span = $client->startSpan('db.query', ['db' => 'postgres']);
// ... do the work ...
$span->finish();

// report() automatically tags trace_id when a trace is active,
// so errors show up correlated to the trace at GET /api/v1/traces/:trace_id (org-wide).
```

- `$client->withTrace(?string $incomingTraceparent = null): self` - returns a new client that starts a new trace, or continues one from an inbound `traceparent` header.
- `$client->getTraceparent(): ?string` - the header value to forward on outgoing requests.
- `$client->startSpan(string $operationName, array $tags = []): Span` → `$span->finish(array $extraTags = [])`.

Database query instrumentation (Database Insights)
--------------------------------------------------

[](#database-query-instrumentation-database-insights)

Set `DITLITI_TRACE_QUERIES=true` (`config('ditliti.trace_queries')`) to auto-instrument every query - query builder, Eloquent, and raw `DB::` calls alike - via Laravel's own `DB::listen` hook, with no query wrapping required:

```
// config/ditliti.php
return [
    // ...
    'trace_queries' => env('DITLITI_TRACE_QUERIES', false),
];
```

With this enabled, `DitlitiServiceProvider::boot()` calls `Ditliti\Laravel\DbTracing::listen($client)`, which records every executed query as a `db.query` span (`db.system.name` from the connection's driver, `db.query.text` the real SQL - the backend parameterizes and hashes it server-side). Failed queries surface via Laravel's `QueryException`, reported through the same `reportable()` hook as `error.type`.

To call these directly instead of via config (e.g. to scope it to one connection):

```
use Ditliti\Laravel\DbTracing;

DbTracing::listen($client, system: 'postgresql');

// In your exception handler, alongside $client->report($exception, ...):
if ($exception instanceof \Illuminate\Database\QueryException) {
    DbTracing::reportQueryException($client, $exception, system: 'postgresql');
}
```

License
-------

[](#license)

MIT - see [LICENSE](https://github.com/kangartha/inspectora/blob/main/LICENSE).

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

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

Unknown

Total

1

Last Release

47d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b94eb7cb8ec30e670d131edcff4d8a7020224201bf7c10af6d3e99a657ff8aa?d=identicon)[candrabasic](/maintainers/candrabasic)

### Embed Badge

![Health badge](/badges/ditliti-laravel-sdk/health.svg)

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

###  Alternatives

[aws/aws-sdk-php

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

6.4k567.5M2.9k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.1k1.0M59](/packages/neuron-core-neuron-ai)[craftcms/cms

Craft CMS

3.6k3.7M3.5k](/packages/craftcms-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3751.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[tempest/framework

The PHP framework that gets out of your way.

2.3k42.4k21](/packages/tempest-framework)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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