sahlowle/larawatch
Composer 安装命令:
composer require sahlowle/larawatch
包简介
A Laravel application monitoring package — requests, exceptions, jobs, health checks, cache, mail, and scheduled tasks.
README 文档
README
A beautiful, self-hosted Laravel application monitoring dashboard
Track HTTP requests, exceptions, queue jobs, health checks, cache stats, mail, and scheduled tasks — all without any external service.
✨ Features
| Module | What it tracks |
|---|---|
| 🌐 Requests | Every HTTP request — method, path, status, duration, IP |
| 💥 Exceptions | PHP exceptions grouped by hash, with full stack traces |
| ⚙️ Queue Jobs | Job processing, completion, and failures |
| ❤️ Health Checks | Database, Redis, Queue, Storage, Mail, Scheduler |
| 🗄️ Cache | Hit rate, memory usage, key count (Redis) |
| Sent and failed emails with recipients and size | |
| 🕐 Scheduled Tasks | Task start, finish, skip, and failure events |
📋 Requirements
- PHP 8.2+
- Laravel 11.x / 12.x
- Livewire 4.x
🚀 Installation
1. Install via Composer
composer require sahlowle/larawatch
2. Publish the config file
php artisan vendor:publish --tag="larawatch-config"
3. Run the migrations
php artisan migrate
4. Record exceptions
Add the following to your bootstrap/app.php:
->withExceptions(function (Exceptions $exceptions): void { $exceptions->reportable(function (\Throwable $e) { if (config('larawatch.enabled') && config('larawatch.features.exceptions', true)) { try { app(\Sahlowle\Larawatch\Services\ExceptionMonitorService::class)->record($e); } catch (\Throwable $ignored) { // Never let monitoring break the app } } }); })
✅ That's it! Visit
/monitorto see your dashboard.
⚙️ Configuration
After publishing, edit config/larawatch.php:
return [ // Enable/disable the entire monitor 'enabled' => env('MONITOR_ENABLED', true), // Dashboard theme: "dark" or "light" 'theme' => env('MONITOR_THEME', 'light'), // URL prefix for the dashboard (default: /monitor) 'path' => env('MONITOR_PATH', 'monitor'), // Restrict access by email or role 'allowed_emails' => ['admin@example.com'], 'allowed_roles' => ['admin'], // Toggle individual modules 'features' => [ 'requests' => true, 'exceptions' => true, 'jobs' => true, 'health' => true, 'cache' => true, 'mail' => true, 'scheduled_tasks' => true, ], // How long to keep data 'data_retention' => [ 'requests' => ['keep_hours' => 1], 'exceptions' => ['keep_days' => 30], 'jobs' => ['keep_days' => 7], 'health_checks' => ['keep_days' => 7], 'cache_stats' => ['keep_days' => 7], 'mails' => ['keep_days' => 30], 'scheduled_tasks' => ['keep_days' => 14], ], ];
Environment Variables
| Variable | Default | Description |
|---|---|---|
MONITOR_ENABLED |
true |
Enable or disable the entire package |
MONITOR_THEME |
light |
Dashboard theme (dark / light) |
MONITOR_PATH |
monitor |
URL prefix for the dashboard |
MONITOR_DB_CONNECTION |
null |
Separate DB connection for monitor tables |
MONITOR_TABLE_PREFIX |
monitor_ |
Prefix for all monitor database tables |
🔐 Authorization
In local environments, all authenticated users can access the dashboard.
In other environments, access is controlled by allowed_emails and allowed_roles in the config. You can also override the viewMonitor gate entirely in your AppServiceProvider:
Gate::define('viewMonitor', function ($user) { return $user->is_admin; });
🗑️ Pruning Old Data
The package provides the larawatch:prune command to clean up old records. Add it to your routes/console.php scheduler:
// Prune all types according to their configured retention Schedule::command('larawatch:prune --force')->daily(); // Or prune a specific type Schedule::command('larawatch:prune --type=requests --force')->hourly();
Available types: requests, exceptions, jobs, health_checks, cache_stats, mails, scheduled_tasks
🗺️ Dashboard Routes
| URL | Description |
|---|---|
/monitor |
Main dashboard |
/monitor/requests |
HTTP request log |
/monitor/exceptions |
Exception tracker |
/monitor/jobs |
Queue job history |
/monitor/health |
Health checks |
/monitor/cache |
Cache & memory stats |
/monitor/mail |
Mail monitor |
/monitor/scheduled-tasks |
Scheduled task history |
/monitor/api/chart-data |
JSON chart data endpoint |
📦 Publishing Assets
# Config only php artisan vendor:publish --tag="larawatch-config" # Migrations only php artisan vendor:publish --tag="larawatch-migrations" # Views (to customize the dashboard UI) php artisan vendor:publish --tag="larawatch-views"
🛠️ Local Development
If you are working on this package inside a host Laravel app using a path repository:
// root composer.json "repositories": [ { "type": "path", "url": "./packages/sahlowle/larawatch" } ], "require": { "sahlowle/larawatch": "*" }, "minimum-stability": "dev", "prefer-stable": true
Then run:
composer update sahlowle/larawatch
Screenshot
📄 License
The MIT License (MIT). See LICENSE for details.
sahlowle/larawatch 适用场景与选型建议
sahlowle/larawatch 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 26 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Metrics」 「monitor」 「health」 「laravel」 「telescope」 「larawatch」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sahlowle/larawatch 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sahlowle/larawatch 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sahlowle/larawatch 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony bundle to monitor and execute commands
Collections of statsd collectors with templated metric names
Is your Laravel app OK? Health checks running in production to ensure you can sleep well at night and be sure everything is still OK.
Provides healthcheck endpoints in accordance with IETF's healthcheck draft RFC
A Laravel package to monitor queue jobs.
Provide status and health api endpoints
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 36
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-02
