PHPackages                             sacred96/timeline - 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. sacred96/timeline

ActiveLibrary

sacred96/timeline
=================

Easy way to create timeline with Laravel

1.0.1(5y ago)492[2 issues](https://github.com/sacred96/timeline/issues)MITPHPPHP ^7.1

Since Mar 19Pushed 5y ago2 watchersCompare

[ Source](https://github.com/sacred96/timeline)[ Packagist](https://packagist.org/packages/sacred96/timeline)[ RSS](/packages/sacred96-timeline/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Timeline
--------

[](#timeline)

Create a timeline history featuring different models

Introduction
------------

[](#introduction)

This package allows you to add a timeline service to your Laravel ^5.8 application

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

[](#installation)

From the command line, run:

```
composer require sacred96/timeline

```

Publish the assets:

```
php artisan vendor:publish

```

Run the migrations:

```
php artisan migrate

```

Usage
-----

[](#usage)

You can specify different Models as participants. Optionally, you can specify the model as the timeline initiator by making it the owner of the timeline. For example, you can have `Invoice` and `Companies` models that are participants in the timeline

#### Main idea

[](#main-idea)

You create a timeline history by specifying multiple models as story participants. When there is an initiating model among the participants, it must use the `TimelineInitiator` trait. For example, for the history of article moderation, the article will be the initiator.

After creating the timeline, you add events to the history with an indication of its author. Additionally, you can specify a detailed comment for the event.

History may have actual state. For example, the initiator model expects user action. This can be indicated in the current state of the timeline. When the story ends, you mark the timeline as complete.

#### Adding the ability to participate in timeline

[](#adding-the-ability-to-participate-in-timeline)

Add the `Sacred96\Timeline\Traits\Eventable` trait to any Model you want to participate in Timeline history.

#### Indicate that the model is the initiator of the timeline

[](#indicate-that-the-model-is-the-initiator-of-the-timeline)

Add the trait `Sacred96\Timeline\Traits\TimelineInitiator` to indicate that this model is the initiator of the timeline.

This can be useful if you want to highlight different sides of the timeline. Let's say you have an invoice that started the timeline. Here he is the initiator. The rest of the actors, such as the invoiced company, will simply be a participant in the timeline.

#### Creating the timeline history

[](#creating-the-timeline-history)

You can start a timeline history with an array of models as participants. You can also set the current state.

```
$history = Timeline::create([$invoiceModel, $userModel, ..., $anotherModel], 'Initial state');
```

#### Get timeline history by id

[](#get-timeline-history-by-id)

```
$history = Timeline::history()->getById($id);
```

#### Add a new event to history

[](#add-a-new-event-to-history)

```
Timeline::event('Event text')
        ->from($eventableModel)
        ->to($history)
        ->withComment('Extended comment to event')
        ->push();
```

#### Get event by id

[](#get-event-by-id)

```
Timeline::events()->getByID($id);
```

#### Get event info

[](#get-event-info)

```
$event->author; // event author

$eventSide = $event->side(); // event side: [initiator_side|second_side]
```

#### Timeline history actual state

[](#timeline-history-actual-state)

```
$history->switchState('New state text'); // Set timeline actual state

$history->getCurrentState(); // Get timeline actual state
```

#### Additional function of timeline history

[](#additional-function-of-timeline-history)

```
Timeline::history($history)->getParticipants(); // get all participants of timeline history
Timeline::history($history)->removeParticipants([$participant1, $participant2]); // delete multiple participants
Timeline::history($history)->getEvents('desc'); // get all events of history with sort
Timeline::history($history)->makeFinished(); // make history as finished
Timeline::history($history)->isFinished(); // check if the story is complete
```

License
-------

[](#license)

Timeline package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

2

Last Release

1879d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a03cfdbbcd3e556bd643e0fdd2cb4a861c3520fd9b1450f01f8580da1b27ee84?d=identicon)[sacred96](/maintainers/sacred96)

---

Top Contributors

[![sacred96](https://avatars.githubusercontent.com/u/20067173?v=4)](https://github.com/sacred96 "sacred96 (18 commits)")

---

Tags

eventshistorylaraveltimelinelaraveleventshistorytimeline

### Embed Badge

![Health badge](/badges/sacred96-timeline/health.svg)

```
[![Health](https://phpackages.com/badges/sacred96-timeline/health.svg)](https://phpackages.com/packages/sacred96-timeline)
```

###  Alternatives

[venturecraft/revisionable

Keep a revision history for your models without thinking, created as a package for use with Laravel

2.6k6.6M51](/packages/venturecraft-revisionable)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)

PHPackages © 2026

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