PHPackages                             phattarachai/laravel-exception-log - 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. phattarachai/laravel-exception-log

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

phattarachai/laravel-exception-log
==================================

Log exceptions to database with smart email alerts and mute capability

v1.0.0(3mo ago)15MITPHPPHP ^8.2

Since Mar 14Pushed 1mo agoCompare

[ Source](https://github.com/phattarachai/laravel-exception-log)[ Packagist](https://packagist.org/packages/phattarachai/laravel-exception-log)[ RSS](/packages/phattarachai-laravel-exception-log/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

Laravel Exception Log
=====================

[](#laravel-exception-log)

บันทึก Exception ลงฐานข้อมูล พร้อมระบบแจ้งเตือนผ่านอีเมล

ความสามารถ
----------

[](#ความสามารถ)

- **บันทึก Exception** — ดักจับทุก Exception ที่เกิดขึ้นในแอป Laravel แล้วบันทึกลง database โดยไม่ต้องแก้โค้ดใดๆ
- **ระบบ Fingerprint Exception** — Exception เดียวกัน (class + file + line เดียวกัน) จะไม่สร้าง record ซ้ำ แต่จะนับจำนวน Exception ที่เกิดขึ้น
- **Request Context** — บันทึกบริบทการเกิด exception อัตโนมัติ (HTTP: URL, method, IP, user / Console: command / Queue: job command) พร้อม sanitize ข้อมูลสำคัญ (password, token, secret, api\_key, credit\_card, cvv)
- **แจ้งเตือนผ่านอีเมล** — ส่งอีเมลแจ้งเตือนเมื่อเกิด exception ใหม่, เมื่อจำนวนถึง milestone (10, 100, 200, 300, ..., 1000, 2000, ...), เมื่อ exception ที่ resolved กลับมาเกิดใหม่ (REOPENED), หรือเมื่อเงียบไปนานแล้วกลับมาเกิดอีก ( re-alert)
- **Resolved/Unresolved** — ทำเครื่องหมาย exception ว่าแก้ไขแล้ว (resolved) ได้ ถ้าเกิดซ้ำจะ reopen อัตโนมัติพร้อมแจ้งเตือน
- **Ignore List** — กำหนด exception class ที่ไม่ต้องการบันทึกได้ (เช่น ValidationException, NotFoundHttpException) รองรับ subclass ด้วย
- **Mute ได้** — ปิดการแจ้งเตือน exception ที่ไม่ต้องการติดตามได้
- **หน้า Admin UI** — ดูรายการ exception ทั้งหมด, filter ตาม status/class/message/วันที่, ดูรายละเอียด stack trace และ context, resolve/reopen, toggle mute, ลบ record ได้
- **Pruning** — ลบ exception เก่าอัตโนมัติตามจำนวนวันที่กำหนด (default 90 วัน)

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

[](#requirements)

- PHP 8.2+
- Laravel 11 หรือ 12

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

[](#installation)

```
composer require phattarachai/laravel-exception-log
```

Publish และ run migration:

```
php artisan vendor:publish --provider="Phattarachai\ExceptionLog\ExceptionLogServiceProvider" --tag="exception-log-migrations"
php artisan migrate
```

Publish config (optional):

```
php artisan vendor:publish --provider="Phattarachai\ExceptionLog\ExceptionLogServiceProvider" --tag="exception-log-config"
```

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

[](#configuration)

เพิ่มใน `.env`:

```
EXCEPTION_LOG_ENABLED=true
EXCEPTION_LOG_NOTIFY_EMAIL=your@email.com
EXCEPTION_LOG_RETENTION_DAYS=90
EXCEPTION_LOG_RE_ALERT_AFTER_HOURS=24
```

### Config Options

[](#config-options)

KeyDefaultDescription`enabled``true`เปิด/ปิดการบันทึก exception`notify_email``null`อีเมลที่จะรับการแจ้งเตือน (null = ไม่ส่ง)`retention_days``90`จำนวนวันที่เก็บ exception ก่อน prune`route_prefix``exception-logs`URL prefix ของหน้า admin`route_middleware``['web', 'auth']`Middleware สำหรับหน้า admin`ignore``[ValidationException, ...]`Exception classes ที่ไม่ต้องการบันทึก`re_alert_after_hours``24`ชั่วโมงที่เงียบไปก่อนจะแจ้งเตือนอีกครั้ง### Ignore List

[](#ignore-list)

กำหนด exception ที่ไม่ต้องการบันทึกใน config:

```
'ignore' => [
    \Illuminate\Validation\ValidationException::class,
    \Illuminate\Auth\AuthenticationException::class,
    \Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class,
    \Illuminate\Database\Eloquent\ModelNotFoundException::class,
],
```

ใช้ `instanceof` ในการเช็ค ดังนั้น subclass จะถูก ignore ด้วย

การใช้งาน
---------

[](#การใช้งาน)

Package จะดักจับ exception ทั้งหมดให้อัตโนมัติ ไม่ต้องแก้โค้ดใดๆ เพียงติดตั้งและ migrate เท่านั้น

### Email Notifications

[](#email-notifications)

ส่งอีเมลแจ้งเตือนเมื่อ:

- เกิด exception **ใหม่ครั้งแรก**
- จำนวนครั้งถึง **milestone** (10, 100, 200, 300, ..., 1000, 2000, ...)
- exception ที่ **resolved แล้วกลับมาเกิดอีก** (subject ขึ้นต้นด้วย "REOPENED:")
- exception ที่ **เงียบไปนาน** เกินค่า `re_alert_after_hours` แล้วกลับมาเกิดอีก

### Request Context

[](#request-context)

ทุก exception จะบันทึกบริบทการเกิดอัตโนมัติ:

- **HTTP** — URL, method, route name, IP, user agent, user ID, sanitized input
- **Console** — artisan command ที่รัน
- **Queue** — queue worker command

ข้อมูลสำคัญ (password, token, secret, api\_key, credit\_card, cvv) จะถูก sanitize เป็น `[REDACTED]` อัตโนมัติ

### Resolved/Unresolved

[](#resolvedunresolved)

- กด **Resolve** เพื่อทำเครื่องหมายว่าแก้ไขแล้ว
- ถ้า exception เดิมเกิดขึ้นอีก จะ **reopen อัตโนมัติ** พร้อมส่งอีเมลแจ้งเตือน
- Filter ดู exception ตาม status ได้ (Unresolved, Resolved, Muted)

### Admin UI

[](#admin-ui)

เข้าดูได้ที่ `/exception-logs` (ต้อง login ก่อน)

กำหนดสิทธิ์ผ่าน Gate:

```
Gate::define('viewExceptionLogs', fn ($user) => $user->isAdmin());
```

### Pruning

[](#pruning)

```
php artisan exception-log:prune
```

หรือใช้ model pruning ของ Laravel:

```
php artisan model:prune --model="Phattarachai\ExceptionLog\Models\ExceptionLog"
```

### Publish Views

[](#publish-views)

```
php artisan vendor:publish --provider="Phattarachai\ExceptionLog\ExceptionLogServiceProvider" --tag="exception-log-views"
```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance87

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

104d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62843288?v=4)[phatchai](/maintainers/phatchai)[@phatchai](https://github.com/phatchai)

---

Top Contributors

[![phattarachai](https://avatars.githubusercontent.com/u/2162876?v=4)](https://github.com/phattarachai "phattarachai (8 commits)")

---

Tags

laravelloggingexceptionerror-tracking

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phattarachai-laravel-exception-log/health.svg)

```
[![Health](https://phpackages.com/badges/phattarachai-laravel-exception-log/health.svg)](https://phpackages.com/packages/phattarachai-laravel-exception-log)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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