larafleet/agent
Composer 安装命令:
composer require larafleet/agent
包简介
Laravel monitoring agent for LaraFleet – sends heartbeats with version, security advisory, queue, and uptime data.
README 文档
README
The official monitoring agent for LaraFleet – the monitoring platform for Laravel applications.
Installation
composer require larafleet/agent php artisan larafleet:install
The install command prompts for your API key from the LaraFleet dashboard
and updates .env automatically.
How it works
The agent runs larafleet:heartbeat every 5 minutes via the Laravel Scheduler.
Only the standard cron entry is required — no queue worker or Supervisor needed:
* * * * * php /path-to-app/artisan schedule:run >> /dev/null 2>&1
Cheap collectors (Queue, Scheduler, Disk) run on every heartbeat. Expensive collectors (Composer, npm, Laravel/PHP version, Env) run once per hour.
| Heartbeat type | Frequency | Payload |
|---|---|---|
full |
Hourly (and first run) | All fields |
quick |
Every 5 min (between full) | Queue, Scheduler, Disk only |
This reduces snapshot rows in the dashboard from ~288 to ~24 per project per day.
What data is sent?
| Category | Details | Frequency |
|---|---|---|
| Queue status | Failed jobs, queue size | Every 5 min |
| Scheduler | Last run, missed | Every 5 min |
| Disk/storage | Directory size in MB | Every 5 min |
| Laravel version | Application::VERSION |
Hourly |
| PHP version + extensions | PHP_VERSION, get_loaded_extensions() |
Hourly |
| Composer packages | Installed, outdated (major/minor/patch) | Hourly |
| Composer security advisories | via composer audit |
Hourly |
| npm packages | Installed, outdated | Hourly |
| npm security advisories | via npm audit |
Hourly |
| Env snapshot | Whitelisted keys only (configurable) | Hourly |
| Deployment | Timestamp (mtime of vendor/autoload.php), Git hash | Hourly |
Exception Reporting
Unhandled exceptions are automatically forwarded to LaraFleet — no extra setup
required after installation. The agent hooks into Laravel's exception handler
and sends a signed report to POST /api/exceptions.
What is reported:
| Field | Description |
|---|---|
exception.class |
Exception class name |
exception.message |
Exception message |
exception.file / line |
Source location |
exception.trace |
Full stack trace |
exception.fingerprint |
SHA-256 hash for deduplication |
request.url |
Request URL (path only, no query string) |
request.query / input |
GET and POST parameters (sensitive fields filtered) |
request.user_id |
Authenticated user ID (no other user data) |
context |
Laravel version, PHP version, environment |
Filtering: the following request keys are replaced with [FILTERED] before
transmission: password, password_confirmation, current_password, token,
api_key. Custom keys can be added via exceptions.dontFlash.
Disabling:
LARAFLEET_EXCEPTIONS_ENABLED=false
Or extend exceptions.dontReport in config/larafleet-agent.php to suppress
specific exception classes:
'exceptions' => [ 'dontReport' => [ \App\Exceptions\MyExpectedException::class, ], ],
Security
- Every request is signed with HMAC-SHA256
- Replay protection: requests older than 60 seconds are rejected by the server
- Env whitelist: only explicitly allowed keys are transmitted
- Input filtering: sensitive request parameters are never transmitted in plain text
- No SSH credentials, no passwords, no full
.envfiles
Configuration
php artisan vendor:publish --tag=larafleet-agent-config
All options in config/larafleet-agent.php:
| Key | Default | Description |
|---|---|---|
endpoint |
https://app.larafleet.com/api/heartbeat |
Server URL |
api_key |
— | From your LaraFleet project settings |
interval_minutes |
5 |
Scheduler run frequency in minutes |
dispatch |
command |
command (synchronous, recommended) or job (Queue) |
timeout |
10 |
HTTP timeout in seconds |
queue |
null |
Queue connection for dispatch=job mode |
npm_enabled |
true |
Enable npm data collection |
env_whitelist |
see config | Allowed env keys |
deployment_file |
vendor/autoload.php |
File used for deployment detection |
collectors.intervals.composer |
3600 |
Composer collector interval in seconds |
collectors.intervals.npm |
3600 |
npm collector interval in seconds |
collectors.intervals.environment |
3600 |
Version/Env collector interval in seconds |
exceptions.enabled |
true |
Enable exception reporting |
exceptions.dontReport |
see config | Exception classes that are never reported |
exceptions.dontFlash |
see config | Request keys replaced with [FILTERED] |
Dispatch mode
By default the heartbeat runs synchronously inside the Scheduler process (dispatch=command).
For apps that already have a running Queue Worker, set LARAFLEET_DISPATCH=job in .env
to offload the heartbeat to the queue instead.
License
MIT
larafleet/agent 适用场景与选型建议
larafleet/agent 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 71 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「security」 「monitoring」 「laravel」 「devops」 「heartbeat」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 larafleet/agent 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 larafleet/agent 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 larafleet/agent 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for chameleon-system/sanitycheck
Provide a way to secure accesses to all routes of an symfony application.
SoftWax Health Check Bundle for Symfony framework
1Pilot client for Symfony
Statsd (Object Oriented) client library for PHP
It's a barebone security class written on PHP
统计信息
- 总下载量: 71
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 42
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-28