stephpy/timeline
Laravel package for recording and displaying chronological “timeline” events on your models. Add entries like notes, status changes, and actions, then query and render them in order for activity feeds and audit-style history.
ModelObserver, Event facade) or custom domain events. This aligns well with audit logs, order workflows, or user activity tracking.DateTime, collections), minimizing invasive changes.DuplicateKey filter)?KnpPager) or database-level optimizations.// Before: Scattered logic in controllers
$timeline = collect($order->events)->sortBy('created_at')->map(...);
// After: Centralized timeline service
$timeline = app(TimelineService::class)
->addEvents($order->events)
->filterBy('status', 'completed')
->render();
timelines table (e.g., using Eloquent models) while keeping the API unchanged.KnpPager integration).composer require stephpy/timeline.OrderShipped event) or create new event listeners.Event::listen(OrderShipped::class, function ($event) {
Timeline::addEntry()
->label('Order Shipped')
->date($event->shippedAt)
->metadata(['tracking_number' => $event->trackingNumber]);
});
KnpPager) for large datasets.description.md are clear, but lack deep-dive examples (e.g., real-world event integration).DuplicateKey) to troubleshoot issues like duplicate entries or misordered timestamps.ORDER BY created_at).KnpPager or Laravel’s built-in pagination).| Failure Scenario | Mitigation | Workaround |
|---|---|---|
| Duplicate timeline entries | Use DuplicateKey filter or database UNIQUE constraints. |
Manual deduplication in application logic. |
| Timestamp inconsistencies | Validate event timestamps before adding to timeline. | Fallback to created_at if custom dates are unreliable. |
| Rendering errors (Blade) | Ensure Blade templates are compatible with the package’s expected data structure. | Use JSON API + client-side rendering. |
| High memory usage | Avoid loading entire timelines into memory; use cursors or pagination. | Stream entries via database cursor. |
UserLogin, PaymentProcessed).How can I help you explore Laravel packages today?