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

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

rivium-trace/laravel-sdk
========================

RiviumTrace Laravel SDK for error tracking, logging, and performance monitoring

v0.1.2(2mo ago)14↓90%MITPHPPHP ^8.1

Since Mar 6Pushed 2mo agoCompare

[ Source](https://github.com/Rivium-co/rivium-trace-laravel)[ Packagist](https://packagist.org/packages/rivium-trace/laravel-sdk)[ RSS](/packages/rivium-trace-laravel-sdk/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (12)Versions (3)Used By (0)

RiviumTrace Laravel SDK
=======================

[](#riviumtrace-laravel-sdk)

Official Laravel SDK for RiviumTrace — error tracking, logging, and APM.

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

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12
- Guzzle 7

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

[](#installation)

```
composer require rivium-trace/laravel-sdk
```

Auto-discovery handles service provider and facade registration.

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

[](#configuration)

Publish config:

```
php artisan vendor:publish --tag=riviumtrace-config
```

Add to `.env`:

```
RIVIUMTRACE_API_KEY=rv_live_your_api_key_here
RIVIUMTRACE_SERVER_SECRET=rv_srv_your_secret_here
RIVIUMTRACE_ENVIRONMENT=production
RIVIUMTRACE_RELEASE=0.1.2
```

### Self-Hosted

[](#self-hosted)

If you're running [RiviumTrace Self-Hosted](https://github.com/Rivium-co/rivium-selfhosted), add `RIVIUMTRACE_API_URL` pointing to your server:

```
RIVIUMTRACE_API_URL=http://your-server:3001
RIVIUMTRACE_API_KEY=rv_live_your_api_key_here
RIVIUMTRACE_SERVER_SECRET=rv_srv_your_secret_here
RIVIUMTRACE_ENVIRONMENT=production
```

Everything else works the same — error tracking, logging, APM, middleware.

Usage
-----

[](#usage)

### Automatic Tracking

[](#automatic-tracking)

RiviumTrace automatically captures:

- **Unhandled exceptions** through Laravel's exception handler
- **HTTP requests** through middleware (timing, status, breadcrumbs)
- **Slow DB queries** as performance spans

### Manual Error Capture

[](#manual-error-capture)

```
use RiviumTrace\Laravel\RiviumTraceFacade as RiviumTrace;

try {
    riskyOperation();
} catch (\Throwable $e) {
    RiviumTrace::captureException($e, [
        'extra' => ['order_id' => $orderId],
    ]);
}

RiviumTrace::captureMessage('Payment processed', [
    'extra' => ['amount' => 99.99],
]);
```

### Breadcrumbs

[](#breadcrumbs)

```
use RiviumTrace\Laravel\Models\Breadcrumb;

RiviumTrace::addBreadcrumb(
    Breadcrumb::custom('User signed up', 'auth', ['plan' => 'pro'])
);

RiviumTrace::addBreadcrumb(
    Breadcrumb::http('POST', '/api/payments', 201, 450.5)
);

RiviumTrace::addBreadcrumb(
    Breadcrumb::user('checkout_completed', ['items' => 3])
);
```

### User Context

[](#user-context)

```
RiviumTrace::setUser([
    'id' => $user->id,
    'email' => $user->email,
    'name' => $user->name,
]);
```

### Scoped Context

[](#scoped-context)

```
RiviumTrace::withScope(function ($scope) {
    $scope->setUser(['id' => 'temp-user']);
    processOrder($order);
});
```

### Logging

[](#logging)

Add the RiviumTrace channel to `config/logging.php`:

```
'channels' => [
    'riviumtrace' => [
        'driver' => 'custom',
        'via' => \RiviumTrace\Laravel\Logging\RiviumTraceLogChannel::class,
    ],

    'stack' => [
        'driver' => 'stack',
        'channels' => ['daily', 'riviumtrace'],
    ],
],
```

Usage:

```
Log::channel('riviumtrace')->info('Order created', ['order_id' => 123]);
Log::channel('riviumtrace')->error('Payment failed', ['reason' => 'declined']);

RiviumTrace::info('Processing started');
RiviumTrace::warn('Rate limit approaching', ['current' => 95, 'max' => 100]);
RiviumTrace::logError('External API timeout', ['service' => 'stripe']);
```

Set a source ID for batched log delivery:

```
RIVIUMTRACE_LOG_SOURCE_ID=my-laravel-api
RIVIUMTRACE_LOG_SOURCE_NAME=My Laravel API
```

### Performance Monitoring

[](#performance-monitoring)

```
use RiviumTrace\Laravel\Performance\PerformanceSpan;

$result = RiviumTrace::trackOperation('process_payment', function () use ($order) {
    return PaymentGateway::charge($order);
}, ['operationType' => 'custom', 'tags' => ['provider' => 'stripe']]);

RiviumTrace::reportPerformanceSpan(
    PerformanceSpan::custom([
        'operation' => 'generate_report',
        'durationMs' => 1500,
        'startTime' => $startTime,
        'tags' => ['report_type' => 'monthly'],
    ])
);

RiviumTrace::reportPerformanceSpan(
    PerformanceSpan::fromHttpRequest([
        'method' => 'POST',
        'url' => 'https://api.stripe.com/v1/charges',
        'statusCode' => 200,
        'durationMs' => 320,
        'startTime' => $startTime,
    ])
);
```

Config Reference
----------------

[](#config-reference)

KeyEnv VarDefaultDescription`api_key``RIVIUMTRACE_API_KEY``''`API key (rv\_live\_xxx / rv\_test\_xxx)`api_url``RIVIUMTRACE_API_URL``https://trace.rivium.co`API URL — set for self-hosted only`server_secret``RIVIUMTRACE_SERVER_SECRET``''`Server secret (rv\_srv\_xxx)`enabled``RIVIUMTRACE_ENABLED``true`Enable/disable SDK`environment``RIVIUMTRACE_ENVIRONMENT``APP_ENV`Environment name`release``RIVIUMTRACE_RELEASE``0.1.0`Release version`sample_rate``RIVIUMTRACE_SAMPLE_RATE``1.0`Error sample rate (0.0-1.0)`debug``RIVIUMTRACE_DEBUG``false`Debug mode`timeout``RIVIUMTRACE_TIMEOUT``5`HTTP timeout (seconds)`performance.enabled``RIVIUMTRACE_PERFORMANCE_ENABLED``true`Enable APM`logging.enabled``RIVIUMTRACE_LOGGING_ENABLED``true`Enable logging`logging.source_id``RIVIUMTRACE_LOG_SOURCE_ID``null`Log source IDIgnored Exceptions
------------------

[](#ignored-exceptions)

By default these exceptions are not reported:

- `AuthenticationException`
- `ValidationException`
- `NotFoundHttpException`
- 4xx HTTP exceptions

Customize in `config/riviumtrace.php`:

```
'exception_handler' => [
    'ignored_exceptions' => [
        \App\Exceptions\BusinessException::class,
    ],
    'report_4xx' => true,
],
```

Middleware
----------

[](#middleware)

Auto-added to `web` and `api` groups. Disable via config:

```
'middleware' => ['enabled' => false],
```

Ignore specific paths:

```
'middleware' => [
    'ignored_paths' => ['_debugbar/*', 'telescope/*', 'health'],
],
```

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance83

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

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

Total

2

Last Release

88d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e5cec9e91ff45e7f90594361cfc2822870da197215ac6b3898f1efad198d4c4?d=identicon)[tazik561](/maintainers/tazik561)

---

Top Contributors

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

---

Tags

laravelloggingmonitoringperformanceapmobservabilityerror-trackingrivium-trace

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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