PHPackages                             codexpedite/laravel-supabase-logger - 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. codexpedite/laravel-supabase-logger

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

codexpedite/laravel-supabase-logger
===================================

A modular Laravel package for logging to Supabase with deduplication, tagging, and occurrence tracking

v1.0.0(9mo ago)0418MITPHPPHP ^8.2

Since Jul 29Pushed 9mo agoCompare

[ Source](https://github.com/codeXpedite/laravel-supabase-logger)[ Packagist](https://packagist.org/packages/codexpedite/laravel-supabase-logger)[ Docs](https://github.com/codeXpedite/laravel-supabase-logger)[ RSS](/packages/codexpedite-laravel-supabase-logger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Supabase Logger
=======================

[](#laravel-supabase-logger)

[![Latest Version on Packagist](https://camo.githubusercontent.com/350e5e99b16742957a440cf95b387594968df1b560cf05dab6a05c8862f9fc66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6465787065646974652f6c61726176656c2d73757061626173652d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codexpedite/laravel-supabase-logger)[![Total Downloads](https://camo.githubusercontent.com/3ce1498007a0a216f8d95ae58ea4e0a2e02c024472d46bc4f638e1b88d8bfaf4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6465787065646974652f6c61726176656c2d73757061626173652d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codexpedite/laravel-supabase-logger)[![License](https://camo.githubusercontent.com/cb92570edd532e8714dddd59c5586d3b5139c180973ec118bdbddce7a2ae9f58/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f6465787065646974652f6c61726176656c2d73757061626173652d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codexpedite/laravel-supabase-logger)

A powerful, modular Laravel package for logging to Supabase (PostgreSQL) with advanced features including deduplication, occurrence tracking, smart tagging, and batch processing.

Features
--------

[](#features)

- 🔄 **Log Deduplication**: Automatically deduplicates identical log messages using MD5 hashing
- 📊 **Occurrence Tracking**: Counts how many times each unique log has occurred
- 🏷️ **Smart Auto-Tagging**: Automatically tags logs based on routes, users, exceptions, and context
- 📦 **Batch Processing**: Efficiently processes logs in configurable batches to optimize API usage
- 🔄 **Fallback Logging**: Graceful error handling with automatic fallback to local file logging
- ⚡ **High Performance**: Built with performance in mind using efficient HTTP client with retry logic
- 🛠️ **Management Commands**: Artisan commands for testing, flushing, and tailing logs
- 🔒 **Security**: Configurable sensitive data sanitization
- 🎯 **Production Ready**: Robust error handling and comprehensive logging

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

[](#requirements)

- PHP 8.2 or higher
- Laravel 10.x, 11.x, or 12.x
- Supabase project with PostgreSQL database

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

[](#installation)

Install the package via Composer:

```
composer require codexpedite/laravel-supabase-logger
```

Publish the configuration file:

```
php artisan vendor:publish --tag=supabase-logger-config
```

Database Setup
--------------

[](#database-setup)

Create the `laravel_logs` table in your Supabase database:

```
CREATE TABLE laravel_logs (
    id BIGSERIAL PRIMARY KEY,
    hash VARCHAR(32) NOT NULL UNIQUE,
    level VARCHAR(20) NOT NULL,
    message TEXT NOT NULL,
    context JSONB,
    app VARCHAR(100) NOT NULL,
    environment VARCHAR(50) NOT NULL,
    occurred_at TIMESTAMP WITH TIME ZONE NOT NULL,
    first_occurred_at TIMESTAMP WITH TIME ZONE NOT NULL,
    last_occurred_at TIMESTAMP WITH TIME ZONE NOT NULL,
    occurrences INTEGER DEFAULT 1,
    tags TEXT[],
    status VARCHAR(20) DEFAULT 'new',
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- Create indexes for better performance
CREATE INDEX idx_laravel_logs_hash ON laravel_logs(hash);
CREATE INDEX idx_laravel_logs_level ON laravel_logs(level);
CREATE INDEX idx_laravel_logs_app_env ON laravel_logs(app, environment);
CREATE INDEX idx_laravel_logs_occurred_at ON laravel_logs(occurred_at);
CREATE INDEX idx_laravel_logs_status ON laravel_logs(status);
CREATE INDEX idx_laravel_logs_tags ON laravel_logs USING GIN(tags);
```

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

[](#configuration)

Add your Supabase credentials to your `.env` file:

```
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
```

Add the Supabase logging channel to your `config/logging.php`:

```
'channels' => [
    // ... other channels

    'supabase' => [
        'driver' => 'custom',
        'via' => \Codexpedite\LaravelSupabaseLogger\SupabaseLoggerCreator::class,
        'level' => env('LOG_LEVEL', 'debug'),
    ],
],
```

Basic Usage
-----------

[](#basic-usage)

```
use Illuminate\Support\Facades\Log;

// Basic logging
Log::channel('supabase')->info('User logged in', ['user_id' => 123]);

// Error logging with context
Log::channel('supabase')->error('Payment failed', [
    'user_id' => 456,
    'order_id' => 789,
    'amount' => 99.99,
    'error' => $exception->getMessage()
]);

// Warning with tags
Log::channel('supabase')->warning('High memory usage detected', [
    'memory_usage' => '512MB',
    'tags' => ['performance', 'monitoring']
]);
```

Management Commands
-------------------

[](#management-commands)

### Test Connection

[](#test-connection)

Test your Supabase connection and configuration:

```
php artisan supabase-logger:test
```

### View Recent Logs

[](#view-recent-logs)

Display recent logs from Supabase:

```
php artisan supabase-logger:tail

# With options
php artisan supabase-logger:tail --limit=100 --level=error
```

### Force Flush Logs

[](#force-flush-logs)

Force flush any pending logs from memory buffer:

```
php artisan supabase-logger:flush
```

Configuration Options
---------------------

[](#configuration-options)

The package provides extensive configuration options in `config/supabase-logger.php`:

```
return [
    // Supabase connection
    'supabase_url' => env('SUPABASE_URL'),
    'supabase_key' => env('SUPABASE_SERVICE_ROLE_KEY'),
    'table_name' => 'laravel_logs',

    // Performance settings
    'batch_size' => 50,
    'flush_interval' => 60, // seconds
    'timeout' => 30,
    'retry_attempts' => 3,
    'retry_delay' => 1000, // milliseconds

    // Auto-tagging
    'auto_tag_routes' => true,
    'auto_tag_users' => true,
    'auto_tag_ips' => true,
    'auto_tag_exceptions' => true,

    // Security
    'sanitize_sensitive_data' => true,
    'sensitive_keys' => ['password', 'token', 'secret', 'key'],

    // Fallback logging
    'fallback_to_file' => true,
    'fallback_path' => storage_path('logs/supabase-fallback.log'),
];
```

Features in Detail
------------------

[](#features-in-detail)

### Log Deduplication

[](#log-deduplication)

The package automatically deduplicates identical log messages using MD5 hashing. When a duplicate log is detected:

- The `occurrences` count is incremented
- The `last_occurred_at` timestamp is updated
- No new database row is created

### Smart Auto-Tagging

[](#smart-auto-tagging)

Logs are automatically tagged based on:

- **Route**: `route:user.profile`
- **User**: `user:123` (when authenticated)
- **Exception**: `exception:ValidationException`
- **IP Address**: `ip:192.168.1.1`
- **Custom Tags**: Via context `tags` array

### Batch Processing

[](#batch-processing)

Logs are collected in memory and sent in configurable batches to reduce API calls and improve performance.

### Error Handling &amp; Fallback

[](#error-handling--fallback)

If Supabase is unavailable, the package will:

1. Attempt to retry the request (configurable retry attempts)
2. Fall back to local file logging if enabled
3. Log errors to Laravel's default log channel
4. Continue operation without breaking your application

Model Usage
-----------

[](#model-usage)

Interact with logs using the provided Eloquent model:

```
use Codexpedite\LaravelSupabaseLogger\Models\LaravelLog;

// Find logs by criteria
$criticalLogs = LaravelLog::level('error')
    ->forApp('my-app')
    ->forEnvironment('production')
    ->recent(24) // last 24 hours
    ->get();

// Update log status
$log = LaravelLog::find($id);
$log->acknowledge(); // Mark as acknowledged
$log->resolve();     // Mark as resolved
$log->reopen();      // Reopen (mark as new)
```

Testing
-------

[](#testing)

```
# Test connection and configuration
php artisan supabase-logger:test

# Run package tests
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability, please send an e-mail to .

Credits
-------

[](#credits)

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

License
-------

[](#license)

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

Changelog
---------

[](#changelog)

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

Support
-------

[](#support)

- 📖 [Documentation](https://github.com/codeXpedite/laravel-supabase-logger)
- 🐛 [Issue Tracker](https://github.com/codeXpedite/laravel-supabase-logger/issues)
- 💬 [Discussions](https://github.com/codeXpedite/laravel-supabase-logger/discussions)

---

Made with ❤️ by CodeXpedite

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance57

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

285d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cec5e45493e796b29b4f3372f985a4601bb79777acf4383a6d278b681ab71fc5?d=identicon)[CodeXpedite](/maintainers/CodeXpedite)

---

Tags

laravelloggingpostgresqlmonologsupabasecentralized-loggingdatabase-logging

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codexpedite-laravel-supabase-logger/health.svg)

```
[![Health](https://phpackages.com/badges/codexpedite-laravel-supabase-logger/health.svg)](https://phpackages.com/packages/codexpedite-laravel-supabase-logger)
```

###  Alternatives

[naoray/laravel-github-monolog

Log driver to store logs as github issues

10619.4k](/packages/naoray-laravel-github-monolog)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)

PHPackages © 2026

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