noir4y/laravel-root-cause 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

noir4y/laravel-root-cause

最新稳定版本:v0.2.4

Composer 安装命令:

composer require noir4y/laravel-root-cause

包简介

Deterministic root-cause diagnostics for Laravel applications.

README 文档

README

Deterministic root-cause diagnostics for Laravel failures.

Laravel Root Cause turns requests, validation failures, exceptions, and query pathologies into reproducible diagnoses with structured JSON output. It is built for cases where you want a deterministic answer, not a generic observability dashboard.

Why This Exists

Telescope is broad observability. Debugbar is a local debugging UI. Ray is a workflow-friendly inspector. Laravel Root Cause is narrower: it classifies the failure, explains why it matched, and exports AI-consumable JSON with candidate fixes.

Tool Best for Output
Telescope Wide framework observability UI-heavy trace inspection
Debugbar Local page-level debugging Browser overlay and debug panels
Ray Fast feedback in your workflow Interactive developer console
Laravel Root Cause Deterministic diagnosis of a failing request CLI summary + structured JSON

Try It In 3 Minutes

composer require noir4y/laravel-root-cause
php artisan root-cause:install
# trigger one failing or pathological request first
php artisan root-cause:trace latest
php artisan root-cause:export latest --format=json

The package auto-registers request collection for the web and api groups by default. Collection is enabled automatically in APP_ENV=local and stays off elsewhere until you set ROOT_CAUSE_ENABLED=true. Traces are written to storage/app/root-cause.

For Users

If you are adopting the package in an application, start with the install and export flow in Try It In 3 Minutes.

Use these docs as the canonical follow-up:

What The Output Looks Like

CLI diagnosis:

Trace: trc_validation_failure
Root cause: validation_contract_mismatch
Confidence: 0.76

Summary: Error 422 occurred due to a mismatch between StoreUserRequest and payload.

Evidence
- StoreUserRequest failed on email.required
- Payload keys: [name]
- Route: users.store / Controller: App\Http\Controllers\UserController@store

Suggested fix
- Include the required field "email" in the request payload or make the rule nullable.
- Review StoreUserRequest to confirm the expected payload keys still match the frontend contract.

Repro
- {"method":"POST","uri":"/users","route_name":"users.store","payload_keys":["name"]}

JSON export:

{
  "trace_id": "trc_exception",
  "diagnosis": {
    "root_cause_category": "unhandled_exception",
    "confidence": 0.62,
    "candidate_fixes": [
      "Inspect the first application frame and add a focused regression test for RuntimeException."
    ]
  }
}

Screenshots:

Terminal diagnosis

JSON export

Public Docs

Commands

php artisan root-cause:trace latest
php artisan root-cause:failed-request
php artisan root-cause:query-pathology
php artisan root-cause:export latest --format=json
php artisan root-cause:prune --days=7

For Contributors

composer install
composer check

Optional Git hooks:

composer hooks:install

Local Git hooks live in .githooks/. Run composer hooks:install only if you want local commits to execute composer lint, composer analyse, and composer test before the commit is created.

Data Model

Each stored artifact is a TraceEnvelope containing:

  • entrypoint metadata
  • sanitized request context
  • normalized signals
  • a deterministic DiagnosisReport

The JSON export compatibility policy for downstream tooling is documented in JSON contract.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固