PHPackages                             borah/llm-monitoring-laravel - 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. borah/llm-monitoring-laravel

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

borah/llm-monitoring-laravel
============================

Advanced LLM monitoring using LLM Port and Filament panel

0.1.1(1y ago)0907↓30%MITPHPPHP ^8.2CI passing

Since Apr 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/BorahLabs/LLM-Monitoring-Laravel)[ Packagist](https://packagist.org/packages/borah/llm-monitoring-laravel)[ Docs](https://github.com/BorahLabs/llm-monitoring-laravel)[ GitHub Sponsors](https://github.com/Borah)[ RSS](/packages/borah-llm-monitoring-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (15)Versions (3)Used By (0)

LLM Monitoring for Laravel
==========================

[](#llm-monitoring-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e092824e50e08d724a99ed7a52a5775e9fa616e45b764887c7e9d42ffef89da0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626f7261682f6c6c6d2d6d6f6e69746f72696e672d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/borah/llm-monitoring-laravel)[![Total Downloads](https://camo.githubusercontent.com/99fe47cca5087ae4ef72dab4db7adce439c488bf436347269e635eebc5378deb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626f7261682f6c6c6d2d6d6f6e69746f72696e672d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/borah/llm-monitoring-laravel)

A comprehensive monitoring solution for Large Language Model usage in Laravel applications using [LLM Port](https://github.com/BorahLabs/LLM-Port-Laravel) and Filament.

Features
--------

[](#features)

- Track LLM API calls and usage statistics
- Evaluate LLM responses using built-in metrics
- Monitor token usage and costs
- Integrated Filament dashboard
- Extensible architecture for custom metrics

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

[](#installation)

You can install the package via composer:

```
composer require borah/llm-monitoring-laravel
```

Then run the installation command:

```
php artisan llm-monitoring:install
```

This will:

- Publish the config file
- Run migrations to create necessary tables
- Copy the LlmPortCall model to your app
- Set up Filament resources and dashboard components

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

[](#configuration)

After installation, you can configure the package in `config/llm-monitoring.php`:

```
return [
    'llmport' => [
        'driver' => null, // one of the llmport.php drivers
        'model' => null,
    ],
    'probability' => 100, // 0 to 100. Chance of a response being evaluated. 100 is always.
    'evaluations' => [
        \Borah\LlmMonitoring\Evaluations\AnswerRelevance::class,
        \Borah\LlmMonitoring\Evaluations\ContextRelevanceChainOfThought::class,
    ],
];
```

Dashboard Setup
---------------

[](#dashboard-setup)

During installation, a Filament dashboard will be set up. Make sure to register it in your Filament panel provider:

```
// in app/Providers/Filament/AdminPanelProvider.php

public function panel(Panel $panel): Panel
{
    return $panel
        // ... other configuration
        ->pages([
            \App\Filament\Pages\LlmDashboard::class,
        ])
        ->discoverWidgets(in: app_path('Filament/LlmMonitoring/Widgets'), for: 'App\\Filament\\LlmMonitoring\\Widgets');
}
```

Adding Custom Widgets
---------------------

[](#adding-custom-widgets)

You can extend the dashboard with your own custom widgets. Create a new class that extends the LlmDashboard:

```
namespace App\Filament\Pages;

use App\Filament\LlmMonitoring\Widgets\LlmCallsChart;
use App\Filament\LlmMonitoring\Widgets\LlmStats;
use App\Filament\LlmMonitoring\Widgets\LlmTokenConsumption;
use App\Filament\Widgets\MyCustomWidget;

class CustomLlmDashboard extends \App\Filament\Pages\LlmDashboard
{
    public function getWidgets(): array
    {
        return [
            LlmStats::class,
            LlmCallsChart::class,
            LlmTokenConsumption::class,
            MyCustomWidget::class,
        ];
    }
}
```

Then update your panel configuration to use your custom dashboard:

```
->pages([
    \App\Filament\Pages\CustomLlmDashboard::class,
])
```

Creating Custom Evaluations
---------------------------

[](#creating-custom-evaluations)

You can create custom evaluation metrics by extending the `BaseEvaluation` class:

```
namespace App\Evaluations;

use Borah\LlmMonitoring\Evaluations\BaseEvaluation;
use Borah\LlmMonitoring\ValueObjects\EvaluationData;
use Borah\LlmMonitoring\ValueObjects\EvaluationResult;
use Borah\LLMPort\ValueObjects\ChatResponse;

class MyCustomEvaluation extends BaseEvaluation
{
    public function identifier(): string
    {
        return 'my-custom-evaluation';
    }

    public function description(): string
    {
        return 'Evaluates something custom about the LLM response';
    }

    public function systemPrompt(EvaluationData $data): string
    {
        return 'You are evaluating the quality of an AI response.';
    }

    public function userPrompt(EvaluationData $data): string
    {
        return "User Query: {$data->query}\n\nAI Response: {$data->response}";
    }

    protected function evaluate(EvaluationData $data, mixed $response): EvaluationResult
    {
        if ($response instanceof ChatResponse) {
            // Process the response and return a result
            return new EvaluationResult(
                value: 0.85,
                formattedValue: '85%',
                metadata: ['details' => 'Additional evaluation details']
            );
        }

        return new EvaluationResult(value: 0, formattedValue: '0%');
    }
}
```

Then add your custom evaluation to the config:

```
'evaluations' => [
    \Borah\LlmMonitoring\Evaluations\AnswerRelevance::class,
    \Borah\LlmMonitoring\Evaluations\ContextRelevanceChainOfThought::class,
    \App\Evaluations\MyCustomEvaluation::class,
],
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Borah](https://github.com/Borah)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance48

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.8% 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

2

Last Release

387d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8dbfeba566942b72c1d32de4763a869cc7cb28f522dbb3ca555d48847a24c077?d=identicon)[RuliLG](/maintainers/RuliLG)

---

Top Contributors

[![RuliLG](https://avatars.githubusercontent.com/u/3358390?v=4)](https://github.com/RuliLG "RuliLG (15 commits)")[![raullg-toptal](https://avatars.githubusercontent.com/u/112110527?v=4)](https://github.com/raullg-toptal "raullg-toptal (1 commits)")

---

Tags

laravelBorahllm-monitoring-laravel

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/borah-llm-monitoring-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/borah-llm-monitoring-laravel/health.svg)](https://phpackages.com/packages/borah-llm-monitoring-laravel)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[spatie/laravel-slack-alerts

Send a message to Slack

3212.6M4](/packages/spatie-laravel-slack-alerts)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

142347.8k](/packages/keepsuit-laravel-opentelemetry)[tapp/filament-maillog

Filament plugin to view outgoing mail

2952.6k1](/packages/tapp-filament-maillog)[spatie/laravel-error-share

Share your Laravel errors to Flare

43965.6k3](/packages/spatie-laravel-error-share)[dotswan/filament-laravel-pulse

82137.2k1](/packages/dotswan-filament-laravel-pulse)

PHPackages © 2026

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