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 Activitylog Laravel Package

spatie/laravel-activitylog

Log user and model activity in Laravel with a simple API. Automatically record Eloquent model events, link actions to subjects and causers, store custom properties, and query a dedicated activity_log table for auditing and history.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Audit Trail & Compliance: Implement a standardized audit trail for user actions, model changes, and system events to meet regulatory requirements (e.g., GDPR, HIPAA, SOX) or internal compliance policies.
  • Debugging & Observability: Enable granular tracking of user interactions and system state changes to simplify debugging, especially in complex workflows or multi-user environments.
  • Feature Roadmap: Accelerate development of:
    • Admin Dashboards: Build real-time activity feeds for administrators (e.g., "Last 10 actions by User X").
    • User Activity History: Add a "Activity Log" tab in user profiles to show their past actions (e.g., for SaaS platforms or collaborative tools).
    • Automated Alerts: Trigger notifications or alerts based on specific activity patterns (e.g., "User deleted a critical record").
  • Build vs. Buy: Avoid reinventing audit logging from scratch. Leverage this package to reduce development time and maintenance overhead while gaining flexibility for customization.
  • Use Cases:
    • E-commerce: Track order modifications, refunds, or customer support interactions.
    • SaaS Platforms: Monitor tenant-specific actions or API usage.
    • Internal Tools: Log changes to sensitive data (e.g., HR records, financial transactions).
    • APIs: Audit external integrations or third-party actions on your models.

When to Consider This Package

  • Adopt if:

    • Your Laravel application requires structured, queryable logs of user/model interactions.
    • You need fine-grained control over what gets logged (e.g., only specific attributes, dirty changes, or fillable fields).
    • Your team prioritizes developer experience with built-in support for model events, custom properties, and hooks.
    • You want to scale logging across multiple "logs" (e.g., separate logs for different modules or tenants).
    • Compliance or debugging demands immutable, searchable activity records without heavy custom code.
  • Look elsewhere if:

    • You need real-time streaming or high-volume logging (consider dedicated tools like Laravel Horizon + database queues or specialized packages like laravel-log-viewer).
    • Your logging requirements are simple (e.g., just timestamps and basic events) and can be handled with Laravel’s built-in Log facade.
    • You’re using non-Laravel backends (e.g., Symfony, Django) or need cross-platform compatibility.
    • You require advanced analytics (e.g., aggregations, dashboards) out of the box (consider integrating with tools like Elasticsearch or Mixpanel).
    • Your team lacks PHP/Laravel expertise to customize the package (though the docs are excellent, some advanced features may need deeper understanding).

How to Pitch It (Stakeholders)

For Executives:

*"This package lets us automatically track every critical action in our app—like a digital breadcrumb trail—without writing custom logging code. It’s like adding a ‘black box recorder’ to our software, which is invaluable for:

  • Compliance: Meeting audit requirements with minimal effort.
  • Trust: Proving to customers that their data is secure and changes are transparent.
  • Efficiency: Saving dev time by avoiding manual logging while gaining deep visibility into user behavior. It’s lightweight, battle-tested (used by thousands of apps), and integrates seamlessly with Laravel. The cost? Just a few hours to set up, versus months to build from scratch."*

For Engineers:

*"This is a Swiss Army knife for audit logging in Laravel. Here’s why it’s a no-brainer:

  • Zero Boilerplate: Log model changes or custom events in one line (e.g., activity()->log('User exported report')).
  • Flexible: Customize what gets logged per model (e.g., only fillable fields, or only dirty changes) via getActivitylogOptions().
  • Powerful Hooks: Add metadata to every log (e.g., IP, user agent, batch IDs) via beforeLogging callbacks.
  • Scalable: Supports multiple logs (e.g., admin-actions, user-activity) and integrates with Laravel’s ecosystem.
  • Battle-Tested: Used in production by 5K+ apps, with active maintenance and great docs. Tradeoff: It’s Laravel-only, but if we’re already using Laravel, this is the fastest way to get enterprise-grade auditing."*

For Data/Analytics Teams:

*"This package gives us structured, queryable activity data out of the box. Unlike raw logs, it:

  • Normalizes events into a consistent schema (e.g., causer, subject, properties).
  • Supports filtering (e.g., ‘Show all activities for User X on Model Y’).
  • Enables enrichment (e.g., add request context via hooks). We can use this as a foundation for:
  • User behavior analysis (e.g., ‘Which features are users ignoring?’).
  • Anomaly detection (e.g., ‘Alert me if a user deletes 10 records in 5 minutes’).
  • Compliance reporting (e.g., ‘Export all changes to PII fields’). Next step: We can extend it with a simple API or dashboard to surface this data."*
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony