- What is haruncpi/laravel-user-activity used for?
- haruncpi/laravel-user-activity is a lightweight Laravel package for monitoring user activity. It records actions such as logins, logouts, and page visits in a database-backed log so you can review recent user behavior. It is best treated as an application feature for visibility, not as a compliance-grade audit system.
- How do I install and configure laravel-user-activity in Laravel?
- Install it with Composer, then publish the package config and migration files, run the migration, and register its middleware as described in the package README. Verify auto-discovery and config caching in your Laravel environment. Start in a non-production branch or staging route group before enabling it broadly.
- Which Laravel and PHP versions are supported by laravel-user-activity?
- The repository and Composer constraints are the source of truth for supported Laravel and PHP versions. The technical assessment specifically recommends confirming Laravel 11+ and PHP 8.3 coverage before rollout. Check compatibility with your database driver, auth guard, and middleware order, especially if you use Laravel Octane.
- Does laravel-user-activity log every request or only login and logout events?
- The package is designed for user activity visibility including logins, logouts, page visits, and other tracked actions. The assessment notes that it may record middleware-tracked requests rather than only auth events, so review the config and middleware behavior. Confirm whether every request, only authenticated routes, or configurable activity types are captured in your setup.
- Can I enable or exclude specific routes from laravel-user-activity logging?
- You should scope middleware carefully so health checks, webhooks, static assets, and low-value routes are excluded. The assessment recommends a POC on one low-risk authenticated route group and one auth guard first. Route-group middleware registration and exclusion rules should be validated in staging before production.
- Does laravel-user-activity store request bodies, IP addresses, or other PII?
- The package is database-backed and, like many activity loggers, may capture metadata such as IP address and user agent. The assessment flags privacy exposure from IP and user-agent capture and asks whether request bodies or sensitive fields are stored. Review the migration, model, and middleware code, then handle retention and access controls according to your PII policy.
- Is laravel-user-activity a replacement for Spatie activity log or compliance audit logging?
- No, it should not be treated as a security control of record or compliance-grade audit logging. It is a lightweight user activity visibility tool, so use a dedicated audit pipeline if you need tamper resistance, strict retention, or regulatory evidence. If you already use Spatie activity log or centralized audit logging, this package may duplicate data and create reconciliation work.
- How does laravel-user-activity affect performance and database size in production?
- Activity tables can grow quickly, and the assessment flags synchronous database writes as a potential latency and write bottleneck at high traffic. Monitor table size and index health, load-test at expected peak RPS, and plan retention or pruning before broad rollout. Validate failure behavior so logging issues do not break critical user flows.
- Does laravel-user-activity support APIs, Sanctum tokens, or multi-tenant applications?
- For SPA and API architectures, it will likely record API calls rather than true page views, so set product expectations accordingly. The assessment recommends confirming support for Sanctum or API tokens and multi-tenant attribution. Multi-tenant apps may need tenant scoping or a schema extension, so test that before rollout.
- How should I test, roll out, and maintain laravel-user-activity safely?
- Run a branch-level POC with one route group and one auth guard, inspect schema, indexes, PII fields, and data quality, then test in staging. Roll out by route group starting with low-risk authenticated areas, add dashboards and access controls, and assign an owner for upgrades and Laravel compatibility. Also plan a retention job and monitor table growth as part of ongoing maintenance.