PHPackages                             deifhelt/laravel-activity-presenter - 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. [Framework](/categories/framework)
4. /
5. deifhelt/laravel-activity-presenter

ActiveLibrary[Framework](/categories/framework)

deifhelt/laravel-activity-presenter
===================================

Activity presenter for Laravel.

v1.1.0(1mo ago)021[2 PRs](https://github.com/StevenU21/laravel-activity-presenter/pulls)MITPHPPHP ^8.1CI passing

Since Jan 25Pushed 1mo agoCompare

[ Source](https://github.com/StevenU21/laravel-activity-presenter)[ Packagist](https://packagist.org/packages/deifhelt/laravel-activity-presenter)[ GitHub Sponsors](https://github.com/deifhelt)[ RSS](/packages/deifhelt-laravel-activity-presenter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (28)Versions (5)Used By (0)

Laravel Activity Presenter
==========================

[](#laravel-activity-presenter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9fca0a8b48d38caedcae8b1df2599ef64cf9831157be26b5d4c826ba2281940c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465696668656c742f6c61726176656c2d61637469766974792d70726573656e7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/deifhelt/laravel-activity-presenter)[![Total Downloads](https://camo.githubusercontent.com/b49c4ae40f7c24b464f7217d059693bb328433532792cf725ca7224de1cb5699/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465696668656c742f6c61726176656c2d61637469766974792d70726573656e7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/deifhelt/laravel-activity-presenter)[![License](https://camo.githubusercontent.com/436d5ebe89d69e20eacb9fb7279105318e36b7bd0cf0fabecd29c651f7a69c08/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465696668656c742f6c61726176656c2d61637469766974792d70726573656e7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/deifhelt/laravel-activity-presenter)

**Laravel Activity Presenter** is a powerful presentation layer for `spatie/laravel-activitylog`. It solves the common challenges of displaying activity logs in your application: resolving relationships efficiently, formatting data consistently, and handling translations.

Why use this?
-------------

[](#why-use-this)

When displaying activity logs, you often face these issues:

1. **N+1 Queries**: Showing "User X updated Project Y" requires loading the User and Project models for every log entry.
2. **Missing Context**: If "Project Y" is deleted, you still want to show its name in the log history, but the relationship is null.
3. **Unformatted Data**: You have `user_id: 5` in the log properties, but you want to display "John Doe".
4. **Inconsistent Presentation**: You find yourself repeating `trans('...')...` logic in every Blade view.

**This package solves all of them.**

Key Features
------------

[](#key-features)

- **Smart Resolution**: Automatically resolves related models (User, Subject) in a single optimized query to prevent N+1 issues.
- **Object-Oriented**: Provides rich objects (`LogEntry`, `AttributeChange`) instead of flat strings, giving you full control in your View.
- **Config-Driven**: Define how specific attributes (like `category_id`) map to models in a simple config file.
- **Auto-Localization**: Built-in support for translating events (`created` -&gt; `Creado`), model names (`User` -&gt; `Usuario`), and attributes.
- **Agnostic &amp; Flexible**: Does not force date formats or string styles. You get the raw `Carbon` objects and Models to format however you like.

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

[](#installation)

Install via Composer (Spatie Activitylog is included automatically):

```
composer require deifhelt/laravel-activity-presenter
```

Publish the configuration:

```
php artisan vendor:publish --provider="Deifhelt\ActivityPresenter\ActivityPresenterServiceProvider"
```

Quick Usage
-----------

[](#quick-usage)

### 1. In your Controller

[](#1-in-your-controller)

```
use Deifhelt\ActivityPresenter\Facades\ActivityPresenter;
use Spatie\Activitylog\Models\Activity;

public function index()
{
    // Fetch logs (paginated)
    $activities = Activity::latest()->paginate(20);

    // Present them (loads relations, formats dates, translates events)
    $presented = ActivityPresenter::presentCollection($activities);

    return view('activities.index', [
        'activities' => $presented
    ]);
}
```

### 2. In your Blade View

[](#2-in-your-blade-view)

```
@foreach($activities as $log)

        {{ $log->activity->created_at->diffForHumans() }}

            @if($log->causer)

                    {{ $log->getCauserLabel() }}

            @else
                System
            @endif

            {{ $log->getEventLabel() }}

            {{ $log->getSubjectLabel() }}

            @foreach($log->changes as $change)

                     {{ $change->key }}:

                     {{ $change->old }}
                     &rarr;

                     @if($change->relatedModel)

                            {{ $change->relatedModel->name }}

                     @else
                        {{ $change->new }}
                     @endif

            @endforeach

@endforeach
```

Documentation
-------------

[](#documentation)

- [Installation &amp; Configuration](docs/installation.md) - Deep dive into setup and config options.
- [Logging Guide](docs/logging.md) - Best practices for logging model events.
- [Usage Patterns](docs/usage.md) - Advanced usage in Controllers, Views, and APIs.
- [Localization](docs/localization.md) - How to translate every aspect of your logs.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance91

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Total

2

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1102199f2512f0899214ab072484185b6499dd1bf518e63a7e9403fe89afa135?d=identicon)[StevenU21](/maintainers/StevenU21)

---

Top Contributors

[![StevenU21](https://avatars.githubusercontent.com/u/89059916?v=4)](https://github.com/StevenU21 "StevenU21 (23 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

frameworklaravelactivityactivitylogactivity presenter

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/deifhelt-laravel-activity-presenter/health.svg)

```
[![Health](https://phpackages.com/badges/deifhelt-laravel-activity-presenter/health.svg)](https://phpackages.com/packages/deifhelt-laravel-activity-presenter)
```

###  Alternatives

[rebing/graphql-laravel

Laravel wrapper for PHP GraphQL

2.2k7.1M26](/packages/rebing-graphql-laravel)[graham-campbell/markdown

Markdown Is A CommonMark Wrapper For Laravel

1.3k7.1M64](/packages/graham-campbell-markdown)[graham-campbell/manager

Manager Provides Some Manager Functionality For Laravel

39221.1M134](/packages/graham-campbell-manager)[lunarstorm/laravel-ddd

A Laravel toolkit for Domain Driven Design patterns

17959.0k](/packages/lunarstorm-laravel-ddd)[jonpurvis/squeaky

A Laravel Validation Rule to Help Catch Profanity.

706.0k](/packages/jonpurvis-squeaky)[yorcreative/laravel-scrubber

A laravel package that scrubs sensitive information for you.

15467.2k2](/packages/yorcreative-laravel-scrubber)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
