bhhaskin/pulse-laravel
Composer 安装命令:
composer require bhhaskin/pulse-laravel
包简介
Laravel integration package that exposes Pulse JS API endpoints.
README 文档
README
bhhaskin/pulse-laravel provides a lightweight Laravel package that exposes API endpoints consumed by Pulse JS. It offers a drop-in route group with sensible defaults and can be extended to surface real-time metrics or diagnostic data for frontend dashboards.
Installation
composer require bhhaskin/pulse-laravel
The package is auto-discovered by Laravel so no manual service provider registration is required.
Configuration
Publish the configuration file to customize the route prefix or middleware stack applied to the beacon endpoint:
php artisan vendor:publish --tag=pulse-config
Key options inside config/pulse.php:
prefix: URL segment that prefixes all Pulse routes. Defaults topulse.middleware: Middleware applied to the Pulse route group. Defaults to theapistack.
Routes
Once installed the package registers the /pulse endpoint (unless you change the prefix) which is designed to be triggered via navigator.sendBeacon. The included controller currently acknowledges requests with an empty 204 No Content response, giving you a clean slate to hook into data sinks or job dispatching as Pulse evolves.
Data Flow
- Incoming batches are captured once in the
pulse_raw_batchestable; the batch processor validates each event and immediately materializes reporting records. - The processor keeps the downstream tables in sync:
pulse_clientskeeps per-client aggregates.pulse_sessionsties events back to a client session.pulse_devicesstores the first-party device fingerprint details (category, OS, viewport, capabilities, browser name/version, etc.) alongside the associated user agent.pulse_eventsholds query-friendly event records and keeps the originalpayloadblob intact so you can enrich analytics with any custom fields Pulse JS sends along.
- Incoming events are validated before persistence; malformed records are skipped so downstream tables stay clean.
- The package auto-loads its migrations; publish them via
php artisan vendor:publish --tag=pulse-migrationsif you need to override the schema.
Because the processing job implements ShouldQueue, make sure your queue worker is running in production, or set QUEUE_CONNECTION=sync if you prefer in-process execution.
Factories & Seeders
- Publish the package factories with
php artisan vendor:publish --tag=pulse-factoriesand seeders withphp artisan vendor:publish --tag=pulse-seedersif you want to customise or extend them inside your application. - You can quickly generate demo data by running the included seeder:
php artisan db:seed --class="\Bhhaskin\Pulse\Database\Seeders\PulseDatabaseSeeder". - When writing package-aware tests, the model factories are auto-loaded so you can use helpers like
PulseClient::factory()out of the box.
Testing
Run the test suite locally with:
composer test
The tests rely on orchestra/testbench to bootstrap a lightweight Laravel application context for package development.
bhhaskin/pulse-laravel 适用场景与选型建议
bhhaskin/pulse-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 41 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bhhaskin/pulse-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bhhaskin/pulse-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 41
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-11