Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Activity Lite

Laravel Activity Lite Laravel Package

garcia1901l/laravel-activity-lite

Lightweight MongoDB-backed activity logger for Laravel (7–12). Automatically tracks model create/update/delete, records the causer (user, artisan, queues), supports manual log entries, configurable events, and powerful querying with CLI filters and JSON/CSV export.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Laravel Activity Lite
How do I install Laravel Activity Lite in my Laravel 11 project?
Run `composer require garcia1901l/laravel-activity-lite` and execute `php artisan activity-lite:install`. This sets up MongoDB collections and publishes the config file. Ensure you have `mongodb/laravel-mongodb:^3.8+` and the PHP MongoDB extension installed first.
Does Laravel Activity Lite work with Laravel 12’s new model events API?
Yes, the package supports Laravel 7–12 and adapts to the model events system in newer versions. Automatic tracking uses Eloquent observers or model events depending on your Laravel version, so no manual adjustments are needed for compatibility.
Can I log custom actions or metadata beyond model changes?
Absolutely. Use `Model::logManualAction('action_name', ['metadata'])` to manually log custom events. This is useful for tracking API calls, background jobs, or any non-model-related activity with additional context.
How do I query logs for a specific model or time range?
Use the CLI: `php artisan activity-lite:query --model=User --days=7` filters logs for the `User` model in the last 7 days. Add `--action=created` to narrow further, or export results with `--json` or `--csv` for reporting.
What if my team doesn’t use MongoDB? Are there SQL alternatives?
Laravel Activity Lite is MongoDB-specific, so if your project uses SQL, consider alternatives like `owen-it/laravel-auditlogs` or `spatie/laravel-activitylog`. These store logs in relational databases and may better suit SQL-based reporting needs.
How does causer detection work for Artisan commands or queue jobs?
The package automatically resolves the causer (user, Artisan command, or queue job) using Laravel’s context. For example, running `php artisan migrate` will log the command name as the causer, while queue jobs use the job’s payload or user context if available.
Can I exclude certain models or events from being logged?
Yes, publish the config file with `php artisan vendor:publish --tag=activity-lite-config` and adjust the `ignored_models` or `ignored_actions` arrays. For example, exclude soft deletes by adding `'deleted'` to `ignored_actions`.
How do I handle large volumes of activity logs for performance?
MongoDB’s indexing and capped collections can help manage performance. Configure TTL indexes in your MongoDB collections to auto-expire old logs, and ensure you index frequently queried fields (e.g., `model_name`, `action`). For read-heavy use cases, consider caching frequent queries.
Will this package work with Laravel’s first-party authentication or custom user providers?
Yes, the package integrates with Laravel’s authentication system out of the box. If you’re using a custom user provider, ensure the `Auth` facade resolves the user correctly, as the causer detection relies on the authenticated user during model events.
How do I migrate existing audit logs to Laravel Activity Lite?
There’s no built-in migration tool, but you can manually export existing logs (e.g., from SQL) and import them into MongoDB using the package’s model structure. Alternatively, backfill logs by triggering manual actions via a script during a maintenance window.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope