定制 burningyolo/laravel-http-monitor 二次开发

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

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

burningyolo/laravel-http-monitor

Composer 安装命令:

composer require burningyolo/laravel-http-monitor

包简介

Track inbound and outbound HTTP requests with IP geolocation data

README 文档

README

Track & monitor inbound + outbound HTTP requests in Laravel with IP tracking, optional geo-location, detailed analytics dashboard, website updates sent to Discord & Slack via webhooks.

Installation

Install the package via Composer:

composer require burningyolo/laravel-http-monitor

Publish the configuration file:

php artisan vendor:publish --tag=request-tracker-config

Publish migrations:

php artisan vendor:publish --tag=request-tracker-migrations

Optionally, publish the views if you want front-end:

php artisan vendor:publish --tag=http-monitor-views

Configuration

The configuration file config/request-tracker.php provides extensive options for customizing the package behavior:

Basic Settings

// Enable/disable the entire package
'enabled' => true,

// Track inbound requests
'track_inbound' => true,

// Track outbound requests
'track_outbound' => true,

// Store request/response headers
'store_headers' => true,

// Store request/response bodies
'store_body' => true,

Exclusions

// Exclude specific paths from inbound tracking
'excluded_paths' => [
    'horizon/*',
    'telescope/*',
    '_debugbar/*',
],

// Exclude specific hosts from outbound tracking
'excluded_outbound_hosts' => [
    'localhost',
    '127.0.0.1',
],

// These fields will be stored as ***omitted***
'omit_body_fields' => [
        'password',
        'password_confirmation',
        .......
    ],

Discord & Slack Webhook Settings

    // Discord Specific Webhook related fields
    'discord' => [
        'webhook_url' => env('REQUEST_TRACKER_DISCORD_WEBHOOK_URL', null),
        'enabled' => env('REQUEST_TRACKER_DISCORD_NOTIFICATIONS_ENABLED', false),
        'bot_name' => env('REQUEST_TRACKER_DISCORD_BOT_NAME', 'Laravel HTTP Monitor'),
        'avatar_url' => env('REQUEST_TRACKER_DISCORD_AVATAR_URL', 'https://avatars.githubusercontent.com/u/81748439'),

    ],
    // Slack Specific Webhook Related fields
    'slack' => [
        'webhook_url' => env('REQUEST_TRACKER_SLACK_WEBHOOK_URL', null),
        'enabled' => env('REQUEST_TRACKER_SLACK_NOTIFICATIONS_ENABLED', false),
    ],

    // the type of data & fields you wanna send via webhook
    'notifications' => [
        'enabled_fields' => [
            'total_inbound' => true,
            'total_outbound' => true,
            'successful_outbound' => true,
            'failed_outbound' => true,
            'avg_response_time' => true,
            'unique_ips' => true,
            'last_24h_activity' => true,
            'ratio_success_failure' => true,
            'top_endpoints' => true,
            'top_ips' => true,
        ],
    ],

Automatic Tracking

Once installed, the package automatically tracks:

  • All inbound requests to web and api middleware groups
  • All outbound HTTP requests made via Laravel's HTTP client

Dashboard

Access the built-in dashboard by visiting:

/http-monitor

Dashboard Overview - Laravel HTTP Monitor

Artisan Commands

View Statistics

Display statistics about tracked requests:

php artisan request-tracker:stats

# Show stats for last 30 days
php artisan request-tracker:stats --days=30

Cleanup Old Logs

Remove old request logs based on custom criteria:

# Delete records older than 30 days
php artisan request-tracker:cleanup --days=30

# Clean only inbound requests
php artisan request-tracker:cleanup --type=inbound

# Clean by status code
php artisan request-tracker:cleanup --status=404

# Preview without deleting
php artisan request-tracker:cleanup --dry-run

# Also remove orphaned IP records
php artisan request-tracker:cleanup --orphaned-ips

Prune Based on Retention Policy

Automatically prune logs according to retention settings in config:

php artisan request-tracker:prune

# Skip confirmation
php artisan request-tracker:prune --force

Clear All Logs

Remove all tracked data (use with caution):

# Clear everything
php artisan request-tracker:clear

# Clear specific type
php artisan request-tracker:clear --type=inbound
php artisan request-tracker:clear --type=outbound
php artisan request-tracker:clear --type=ips

# Skip confirmation
php artisan request-tracker:clear --force

Send Stats to Discord & Slack

Based on Config the Data will be sent of last 24 hours.

# Send Notification
php artisan request-tracker:send-stats

Example Discord Stats

Example Slack Stats

Important note

All listed Artisan commands are manual only. They do not run automatically.

If you want to run any of them on a schedule (e.g. daily stats, cleanup, etc.), add them to your Laravel scheduler.

use Illuminate\Support\Facades\Schedule;

Schedule::command('request-tracker:send-stats')
        ->dailyAt('08:00');

Accessing Tracked Data

Query tracked requests using the provided models:

use Burningyolo\LaravelHttpMonitor\Models\InboundRequest;
use Burningyolo\LaravelHttpMonitor\Models\OutboundRequest;
use Burningyolo\LaravelHttpMonitor\Models\TrackedIp;

Database Schema

inbound_requests

Stores incoming HTTP requests with columns for method, URL, headers, body, status code, duration, user information, and more.

outbound_requests

Stores outgoing HTTP requests with similar structure plus fields for tracking what triggered the request and success/failure status.

tracked_ips

Stores unique IP addresses with optional geolocation data including country, region, city, coordinates, timezone, ISP, and organization.

View the model files src/Models/ to get more info about the columns.

Some Considerations

  • Enable geo_dispatch_async to fetch geolocation data in background jobs
  • Use excluded_paths to skip tracking of static assets and admin panels
  • Consider disabling body storage for high-traffic applications

License

This package is open-source software licensed under the MIT license.

Credits

Developed by Burningyolo

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please open an issue on GitHub.

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

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-23