Search by

itmosoft / laravel-activity-timeline

adeelrao007

Polymorphic activity feed and chronological event timeline for Laravel models, with actor attribution and structured properties.

Package info

github.com/ITMOSOFT/laravel-activity-timeline

pkg:composer/itmosoft/laravel-activity-timeline

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-17 10:11 UTC

This package is auto-updated.

Last update: 2026-11-17 10:13:53 UTC


README

A lightweight polymorphic activity feed for Laravel 12 and 13. Record chronological events against Eloquent models, attribute events to actors, and store structured properties.

Requirements

  • PHP 8.3+
  • Laravel 12 or 13

Installation

composer require itmosoft/laravel-activity-timeline
php artisan vendor:publish --tag=itmosoft-activity-timeline-config
php artisan migrate

Record an activity

use ItmoSoft\ActivityTimeline\Facades\ActivityTimeline;

ActivityTimeline::record(
    subject: $order,
    event: 'status.changed',
    description: 'Order status changed to processing',
    causer: auth()->user(),
    properties: ['from' => 'pending', 'to' => 'processing'],
);

Retrieve a timeline

$activities = ActivityTimeline::forSubject($order)->latest()->limit(20)->get();

Add the relationship to a model:

use ItmoSoft\ActivityTimeline\Concerns\HasActivityTimeline;

class Order extends Model
{
    use HasActivityTimeline;
}

Then query $order->activities.

API

  • record(Model $subject, string $event, string $description, ?Model $causer = null, array $properties = [], ?DateTimeInterface $occurredAt = null): Activity
  • forSubject(Model $subject): Builder
  • forCauser(Model $causer): Builder
  • latest(): Builder
  • oldest(): Builder

Configuration

Publish config/activity-timeline.php to change the table name:

return ['table' => 'activity_timeline'];

Scope and limitations

  • Explicit application events only; no automatic model observers.
  • This is an activity feed, not a replacement for itmosoft/laravel-audit-log.
  • No admin UI, HTTP endpoints, notifications, retention scheduler, or export tools.
  • Properties must be JSON-serializable. Avoid storing secrets or unnecessary personal data.
  • Applications must enforce their own authorization for viewing activities.

Testing

composer install
composer test

MIT License. See LICENSE.