定制 hashcrypttech/hashguardian 二次开发

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

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

hashcrypttech/hashguardian

Composer 安装命令:

composer require hashcrypttech/hashguardian

包简介

Self-hosted monitoring and observability dashboard for Laravel applications

README 文档

README

Self-hosted monitoring and observability dashboard for Laravel applications. Track requests, queries, exceptions, jobs, and more — all within your own infrastructure.

Screenshots

Server Monitoring

Server Monitoring

Htop Monitor

Htop Monitor

Requirements

  • PHP 8.2+
  • Laravel 11.x or 12.x

Installation

Install the package via Composer:

composer require hashcrypttech/hashguardian

The service provider and facade are auto-discovered by Laravel. No manual registration is needed.

Run the install command to publish the config, migrations, and assets:

php artisan hashguardian:install

This will:

  • Publish the config/hashguardian.php configuration file
  • Publish the HashGuardianServiceProvider to app/Providers/
  • Publish frontend assets to public/vendor/hashguardian/
  • Run database migrations

Configuration

After installation, configure HashGuardian via config/hashguardian.php or environment variables:

HASHGUARDIAN_ENABLED=true
HASHGUARDIAN_PATH=hashguardian
HASHGUARDIAN_DB_CONNECTION=mysql
HASHGUARDIAN_PRUNE_HOURS=72

Authorization

By default, the HashGuardian dashboard is only accessible in the local environment. To configure access in production, define the viewHashGuardian gate in your App\Providers\HashGuardianServiceProvider:

use Hashcrypttech\HashGuardian\Facades\HashGuardian;

HashGuardian::auth(function ($request) {
    return in_array($request->user()?->email, [
        'admin@example.com',
    ]);
});

Dashboard

Access the monitoring dashboard at:

https://your-app.com/hashguardian

Watchers

HashGuardian includes 20 built-in watchers that can be individually enabled/disabled:

Watcher Description Env Variable
RequestWatcher HTTP requests and response times HASHGUARDIAN_REQUEST_WATCHER
QueryWatcher Database queries with slow query detection HASHGUARDIAN_QUERY_WATCHER
ExceptionWatcher Exceptions with stack traces HASHGUARDIAN_EXCEPTION_WATCHER
JobWatcher Queue jobs HASHGUARDIAN_JOB_WATCHER
OutgoingRequestWatcher Outgoing HTTP calls HASHGUARDIAN_OUTGOING_REQUEST_WATCHER
CacheWatcher Cache hits, misses, writes HASHGUARDIAN_CACHE_WATCHER
MailWatcher Sent emails HASHGUARDIAN_MAIL_WATCHER
NotificationWatcher Notifications HASHGUARDIAN_NOTIFICATION_WATCHER
CommandWatcher Artisan commands HASHGUARDIAN_COMMAND_WATCHER
ScheduleWatcher Scheduled tasks HASHGUARDIAN_SCHEDULE_WATCHER
LogWatcher Log entries HASHGUARDIAN_LOG_WATCHER
ActivityWatcher User activity tracking HASHGUARDIAN_ACTIVITY_WATCHER
BatchWatcher Batch operations HASHGUARDIAN_BATCH_WATCHER
DumpWatcher dump() / dd() output HASHGUARDIAN_DUMP_WATCHER
EventWatcher Laravel events HASHGUARDIAN_EVENT_WATCHER
GateWatcher Authorization checks HASHGUARDIAN_GATE_WATCHER
ModelWatcher Eloquent model events HASHGUARDIAN_MODEL_WATCHER
RedisWatcher Redis operations HASHGUARDIAN_REDIS_WATCHER
ViewWatcher View rendering HASHGUARDIAN_VIEW_WATCHER

Custom Metrics

Track custom business metrics in your application:

use Hashcrypttech\HashGuardian\Facades\HashGuardian;

// Count events
HashGuardian::count('orders.placed');

// Record numeric metrics
HashGuardian::metric('payment.amount', 99.99);

// Time operations
HashGuardian::startTimer('api.call');
// ... your code ...
HashGuardian::stopTimer('api.call');

API Access

Enable the REST API for programmatic access:

HASHGUARDIAN_API_ENABLED=true

Create API tokens:

php artisan hashguardian:token create "My Token"

Artisan Commands

Command Description
hashguardian:install Install the package (publish config, migrations, assets)
hashguardian:publish Publish/update frontend assets
hashguardian:prune Remove old entries
hashguardian:clear Clear all recorded data
hashguardian:pause Temporarily pause recording
hashguardian:resume Resume recording
hashguardian:monitor Start server metrics collection (long-running)
hashguardian:aggregate Build metric aggregates for trends
hashguardian:token Manage API tokens
hashguardian:stats Display summary statistics
hashguardian:tail Live-tail entries in the terminal
hashguardian:report Generate a summary report

Scheduled Tasks

Add these to your routes/console.php or scheduler:

use Illuminate\Support\Facades\Schedule;

Schedule::command('hashguardian:prune')->daily();
Schedule::command('hashguardian:aggregate')->hourly();

Server Monitoring

Enable server resource monitoring (CPU, RAM, disk, network):

HASHGUARDIAN_SERVER_MONITORING=true

Run the monitor as a background process:

php artisan hashguardian:monitor

Publishing Assets

To update assets after a package update:

php artisan hashguardian:publish

Or use vendor:publish with tags:

php artisan vendor:publish --tag=hashguardian-config
php artisan vendor:publish --tag=hashguardian-assets
php artisan vendor:publish --tag=hashguardian-provider

About

HashGuardian is developed and maintained by Hashcrypt Technologies Pvt. Ltd., a software development company based in Rajkot, Gujarat, India.

License

HashGuardian is open-sourced software licensed under the MIT license.

hashcrypttech/hashguardian 适用场景与选型建议

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

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

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

围绕 hashcrypttech/hashguardian 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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