systemsx/lantern

Laravel-first custom events and metrics for Lantern.

Maintainers

Package info

github.com/systemsxteam/lantern-nightwatch

pkg:composer/systemsx/lantern

Transparency log

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-08-20 18:57 UTC

This package is auto-updated.

Last update: 2026-08-20 19:04:19 UTC


README

Send type-safe Custom Events and counter, gauge, and distribution points from Laravel to Lantern. Delivery uses your Laravel queue and Lantern's native HTTP API; Laravel Nightwatch is optional and is used only for best-effort trace correlation.

composer require systemsx/lantern
LANTERN_ENABLED=true
LANTERN_INGEST_URL=https://ingress.lantern.example
LANTERN_TOKEN=
LANTERN_QUEUE_CONNECTION=
LANTERN_QUEUE=lantern
LANTERN_TIMEOUT=10
LANTERN_CONNECT_TIMEOUT=3

Ensure a worker processes the dedicated queue:

php artisan queue:work --queue=lantern,default
use SystemsX\Lantern\Facades\Lantern;

Lantern::event('ai.completion', [
    'model' => 'gpt-5',
    'input_tokens' => 1250,
    'output_tokens' => 420,
]);

Lantern::counter('ai.cost_usd', 0.0142, ['model' => 'gpt-5']);
Lantern::gauge('users.active', 428);
Lantern::distribution('checkout.duration_ms', 182.4, ['region' => 'eu-west-2']);

Records are validated synchronously, buffered for the current request, command, or queued job, and then delivered in retried queue jobs of at most 500 records. Network and receiver failures do not fail the instrumented execution. Long-running custom workers should call Lantern::flush() at their own execution boundary.

For application tests:

$lantern = Lantern::fake();

Lantern::event('order.completed', ['order_id' => '123']);

$lantern->assertEventRecorded('order.completed');

Development

composer install
composer test

The package supports PHP 8.2+ and Laravel 11, 12, and 13.