定制 clawdbot/laravel-monitor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

clawdbot/laravel-monitor

Composer 安装命令:

composer require clawdbot/laravel-monitor

包简介

Real-time error monitoring and AI-powered debugging for Laravel applications

README 文档

README

Real-time error monitoring, slow query detection, and AI-powered debugging for Laravel applications. Reports issues directly to your Clawdbot instance for automatic analysis, issue creation, and PR generation.

Installation

composer require clawdbot/laravel-monitor

Configuration

Publish the config:

php artisan vendor:publish --tag=clawdbot-monitor-config

Add to your .env:

CLAWDBOT_PROJECT_ID=my-project
CLAWDBOT_WEBHOOK_URL=https://your-clawdbot-gateway/api/monitor
CLAWDBOT_WEBHOOK_SECRET=your-secret-key

# Optional tuning
CLAWDBOT_REPORT_EXCEPTIONS=true
CLAWDBOT_REPORT_SLOW_QUERIES=true
CLAWDBOT_SLOW_QUERY_THRESHOLD=500
CLAWDBOT_REPORT_FAILED_JOBS=true
CLAWDBOT_QUEUE_REPORTS=true

Features

Exception Reporting

Automatically catches and reports all unhandled exceptions with full context:

  • Stack trace
  • Request data (URL, method, input, headers)
  • User context (ID, email, name)
  • Environment info
// Exceptions are reported automatically. To report manually:
use Clawdbot\Monitor\Facades\ClawdbotMonitor;

ClawdbotMonitor::reportException($exception, [
    'custom_context' => 'value',
]);

Slow Query Detection

Monitors all database queries and reports those exceeding the threshold:

CLAWDBOT_SLOW_QUERY_THRESHOLD=500  # milliseconds

Reports include:

  • SQL query with bindings
  • Execution time
  • Source file/line (where the query originated)
  • Connection name

Failed Job Reporting

Automatically reports failed queue jobs:

  • Job class and payload
  • Exception details
  • Queue/connection info

User Complaint API

Built-in API endpoint for users or support to report issues:

POST /api/clawdbot/complaint
Authorization: Bearer {token}

{
    "description": "My balance doesn't update after payment",
    "category": "payment",
    "steps": "1. Made a payment via Stripe\n2. Checked balance page\n3. Balance still shows old amount",
    "expected": "Balance should reflect the payment",
    "actual": "Balance unchanged after 10 minutes"
}

Debug API (Optional)

Allow Clawdbot to remotely debug issues:

CLAWDBOT_ALLOW_DEBUG_QUERIES=true     # Enable read-only SQL queries
CLAWDBOT_ALLOW_IMPERSONATION=true     # Enable user context lookup

Available endpoints (HMAC-signed):

  • POST /api/clawdbot/debug/query - Execute read-only SELECT queries
  • POST /api/clawdbot/debug/user-context - Get user info + relationships
  • POST /api/clawdbot/debug/logs - Read application logs

Custom Events

Report custom events from anywhere in your app:

use Clawdbot\Monitor\Facades\ClawdbotMonitor;

// Payment webhook failed
ClawdbotMonitor::reportEvent('webhook.failed', [
    'provider' => 'stripe',
    'event_type' => 'payment_intent.succeeded',
    'error' => 'Timeout connecting to database',
]);

// Unusual activity
ClawdbotMonitor::reportEvent('security.unusual_login', [
    'user_id' => 123,
    'ip' => '1.2.3.4',
    'country' => 'XX',
]);

Testing

Verify your setup works:

php artisan clawdbot:test
php artisan clawdbot:test --type=slow_query
php artisan clawdbot:test --type=failed_job
php artisan clawdbot:test --type=event

Security

  • All debug endpoints are protected by HMAC signature verification
  • Only SELECT queries allowed through the debug API
  • Sensitive data (passwords, tokens, API keys) automatically redacted
  • IP allowlisting supported for debug endpoints
  • Request input sanitized and truncated

Webhook Payload Format

All reports follow this structure:

{
    "type": "exception|slow_queries|failed_job|complaint|custom_event|health",
    "project_id": "my-project",
    "environment": "production",
    "server": {
        "hostname": "web-01",
        "ip": "10.0.0.1",
        "php_version": "8.3.0",
        "laravel_version": "11.0.0"
    },
    "timestamp": "2026-01-28T12:00:00.000Z",
    "data": { ... }
}

License

MIT

clawdbot/laravel-monitor 适用场景与选型建议

clawdbot/laravel-monitor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「errors」 「debugging」 「monitoring」 「laravel」 「ai」 「clawdbot」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 clawdbot/laravel-monitor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 clawdbot/laravel-monitor 我们能提供哪些服务?
定制开发 / 二次开发

基于 clawdbot/laravel-monitor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-28