PHPackages                             jimmyahalpara/laravel-activitylog-enricher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. jimmyahalpara/laravel-activitylog-enricher

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

jimmyahalpara/laravel-activitylog-enricher
==========================================

A Laravel package to enrich Spatie ActivityLog entries by resolving foreign key IDs to readable labels

1.1.0(6mo ago)05[6 PRs](https://github.com/jimmyahalpara/activity-log-enricher/pulls)MITPHPPHP ^8.2CI passing

Since Oct 21Pushed 3mo agoCompare

[ Source](https://github.com/jimmyahalpara/activity-log-enricher)[ Packagist](https://packagist.org/packages/jimmyahalpara/laravel-activitylog-enricher)[ Docs](https://github.com/jimmyahalpara/laravel-activitylog-enricher)[ RSS](/packages/jimmyahalpara-laravel-activitylog-enricher/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (9)Versions (10)Used By (0)

Laravel ActivityLog Enricher
============================

[](#laravel-activitylog-enricher)

[![Latest Version on Packagist](https://camo.githubusercontent.com/020cc360cf25c87616009fd1279859f445b792b0b70523f22f71684922289560/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a696d6d796168616c706172612f6c61726176656c2d61637469766974796c6f672d656e7269636865722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jimmyahalpara/laravel-activitylog-enricher)[![Total Downloads](https://camo.githubusercontent.com/cd02289e8ae6983024fbb6f7c3d4c2aeb88a9752a5f3588fb4acc9f0b8a3ba26/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a696d6d796168616c706172612f6c61726176656c2d61637469766974796c6f672d656e7269636865722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jimmyahalpara/laravel-activitylog-enricher)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0a0d3b8bb13874017a49b680a03f47d9c66e89e06955b254bfb28af134ae6fc1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6a696d6d796168616c706172612f6c61726176656c2d61637469766974796c6f672d656e7269636865722f54657374733f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jimmyahalpara/laravel-activitylog-enricher/actions?query=workflow%3ATests+branch%3Amain)[![PHP Stan](https://camo.githubusercontent.com/fff00cebb924e124a7335e6bd8ca8f8cf38869463c1654eff45d0939f1f21c57/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://phpstan.org/)

A Laravel package that enriches [Spatie ActivityLog](https://github.com/spatie/laravel-activitylog) entries by resolving foreign key IDs to human-readable labels, making your audit trails more meaningful and user-friendly.

Features
--------

[](#features)

- 🔄 **Automatic Foreign Key Resolution**: Convert foreign key IDs to readable labels
- 🏗️ **Nested Array Support**: Handle complex nested structures like `items.*.material_id`
- 🎯 **Flexible Label Sources**: Support for model attributes, accessor methods, or custom methods
- 🗂️ **Predefined Configurations**: Reusable mapping configurations via config file
- 🛡️ **Soft Delete Awareness**: Handles soft-deleted models gracefully
- 🚫 **Error Resilient**: Continues enrichment even when some models are missing
- 🧪 **Fully Tested**: Comprehensive test suite with 100% coverage
- 📋 **Type Safe**: Full PHP 8.1+ type declarations and PHPStan level 8 compliance

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 9.0, 10.0, 11.0, or 12.0
- Spatie Laravel ActivityLog 4.0+

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require jimmyahalpara/laravel-activitylog-enricher

```

The package will automatically register its service provider.

Optionally, publish the configuration file:

```
php artisan vendor:publish --provider="JimmyAhalpara\ActivityLogEnricher\ActivityLogEnricherServiceProvider" --tag="activity-log-enricher-config"

```

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

Use the enricher in your model's `tapActivity` method:

```
