PHPackages                             laikmosh/plog - 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. laikmosh/plog

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

laikmosh/plog
=============

Advanced Laravel logging system with metadata capture, tagging, and powerful filtering

1.0.8(5mo ago)053MITPHPPHP ^8.2

Since Nov 29Pushed 5mo agoCompare

[ Source](https://github.com/laikmosh/plog)[ Packagist](https://packagist.org/packages/laikmosh/plog)[ RSS](/packages/laikmosh-plog/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (9)Used By (0)

Plog - Advanced Laravel Logging Package
=======================================

[](#plog---advanced-laravel-logging-package)

Plog is a powerful Laravel logging enhancement package that captures extensive metadata, supports tagging, and provides an interactive web interface for log exploration.

Features
--------

[](#features)

- **Automatic Metadata Capture**: User ID, Session ID, Request ID, file/line, class/method
- **Request Tracking**: Track logs across HTTP requests, queued jobs, and CLI commands
- **Tagging System**: Organize logs with tags for easy filtering
- **Interactive Web Interface**: Filter, search, and explore logs with Livewire + Alpine.js
- **Flexible Storage**: SQLite by default, configurable to any Laravel database
- **Granular Retention**: Configure different retention periods for different log types

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

[](#installation)

```
composer require laikmosh/plog
```

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

[](#configuration)

Publish the configuration file and assets:

```
php artisan vendor:publish --tag=plog-config
php artisan vendor:publish --tag=plog-assets
```

Run migrations:

```
php artisan migrate
```

### Environment Variables

[](#environment-variables)

```
# Enable/disable Plog
PLOG_ENABLED=true

# Authorized emails (comma-separated)
PLOG_AUTHORIZED_EMAILS=admin@example.com,developer@example.com

# Database connection (optional, defaults to SQLite)
PLOG_DB_CONNECTION=plog

# Default retention period
PLOG_RETENTION_DAYS=7

# Enable automatic cleanup
PLOG_CLEANUP_ENABLED=true
```

Usage
-----

[](#usage)

### Basic Logging

[](#basic-logging)

All existing Laravel log calls automatically capture metadata:

```
Log::info('User logged in', ['user_id' => $user->id]);
Log::error('Payment failed', ['order_id' => $orderId]);
```

### Using Tags

[](#using-tags)

You can add tags to organize and filter your logs. Tags work seamlessly with Laravel's standard Log facade:

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

// Add tags using the special '_tags' key in the context array
Log::info('Order processed', [
    'order_id' => $orderId,
    '_tags' => ['payment', 'stripe']
]);

Log::error('Connection failed', ['_tags' => ['database', 'error']]);

Log::warning('Slow query', [
    'time' => 2.5,
    '_tags' => ['performance', 'database']
]);

// The _tags key is automatically extracted and stored separately
// It won't appear in your logged context data
```

This approach works with ALL Laravel log methods and doesn't require any changes to existing code. Just add `'_tags' => ['tag1', 'tag2']` to your context array when needed.

### Viewing Logs

[](#viewing-logs)

Access the web interface at `/logs` (requires authentication and authorization).

The interface allows you to:

- Filter by level, user, request ID, session, environment, endpoint, and tags
- Search through log messages and context
- Click any field to instantly filter by that value
- View detailed log entries with full context
- Group logs by request to trace execution flow

Advanced Configuration
----------------------

[](#advanced-configuration)

### Custom Database Connection

[](#custom-database-connection)

In `config/plog.php`:

```
'database' => [
    'connection' => 'mysql', // Use your app's main database
    'table' => 'plog_entries',
],
```

### Retention Policies

[](#retention-policies)

Configure granular retention rules:

```
'retention' => [
    'default_days' => 7,
    'rules' => [
        ['tags' => ['payment'], 'days' => 30],
        ['tags' => ['authentication'], 'days' => 90],
        ['level' => 'error', 'days' => 14],
    ],
],
```

### Authorization

[](#authorization)

Control access via email whitelist:

```
'authorized_emails' => [
    'admin@example.com',
    'developer@example.com',
],
```

Or customize the gate in your `AuthServiceProvider`:

```
Gate::define('viewPlog', function ($user) {
    return $user->hasRole('admin');
});
```

Request ID Tracking
-------------------

[](#request-id-tracking)

Plog automatically generates and tracks request IDs across:

- HTTP requests
- Queued jobs (preserves original request ID)
- CLI commands

Access the current request ID:

```
use Laikmosh\Plog\Services\RequestIdService;

$requestId = app(RequestIdService::class)->getRequestId();
```

Captured Metadata
-----------------

[](#captured-metadata)

Each log entry captures:

- **Time**: Timestamp with microseconds
- **Level**: debug, info, notice, warning, error, critical, alert, emergency
- **Message**: Log message
- **Context**: Additional data passed to the log
- **User ID**: Currently authenticated user
- **Session ID**: Current session identifier
- **Request ID**: Unique request identifier
- **Environment**: http, cli, queue, testing
- **Endpoint**: Route name or URI, CLI command
- **File &amp; Line**: Source code location
- **Class &amp; Method**: Calling class and method
- **Tags**: Custom tags for organization

Performance Considerations
--------------------------

[](#performance-considerations)

- Logs are written synchronously by default
- Consider using a dedicated database for high-volume applications
- Indexes are automatically created for common query patterns
- Use retention policies to manage database size

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance71

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

Total

8

Last Release

161d ago

PHP version history (2 changes)1.0.0PHP ^8.1

1.0.2PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/1bd30c4d9a8794e2e07ec6a2595dbb6e233d19ed093bc4143f4023702a648684?d=identicon)[laikmosh](/maintainers/laikmosh)

---

Top Contributors

[![laikmosh](https://avatars.githubusercontent.com/u/11953474?v=4)](https://github.com/laikmosh "laikmosh (16 commits)")

---

Tags

laravelloggingmonitoringdebuggingplog

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laikmosh-plog/health.svg)

```
[![Health](https://phpackages.com/badges/laikmosh-plog/health.svg)](https://phpackages.com/packages/laikmosh-plog)
```

###  Alternatives

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[honeybadger-io/honeybadger-laravel

Honeybadger Laravel integration

431.2M](/packages/honeybadger-io-honeybadger-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[hryha/laravel-request-logger

A Laravel package to log requests and responses

102.2k](/packages/hryha-laravel-request-logger)

PHPackages © 2026

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