vivekmarakana / yii2-timeline-widget
Timeline/Telemetry Widget for Yii2
Installs: 5 627
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 7
Open Issues: 0
Type:yii2-extension
Requires
- rmrevin/yii2-fontawesome: ~2.12
- yiisoft/yii2: >=2.0.0
This package is auto-updated.
Last update: 2024-11-10 17:21:19 UTC
README
Timeline/Telemetry Widget for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist vivekmarakana/yii2-timeline-widget "*"
or add
"vivekmarakana/yii2-timeline-widget": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
<?php $items = []; foreach ($posts as $post) { $data = []; $data['title'] = $post->title; $data['date'] = \Yii::$app->formatter->asDate(date("Y-m-d H:i:s", strtotime('+330 minutes', strtotime($post->published_at))), 'php:d M,Y'); $data['time'] = \Yii::$app->formatter->asDate(date("Y-m-d H:i:s", strtotime('+330 minutes', strtotime($post->published_at))), 'php:h:i A'); $data['notes'] = $post->summary; if(!is_null($post->postedBy)) { $data['subtitle'] = "By {$post->postedBy->name} - {$post->postedBy->bio}"; } $items[] = $data; } \vivekmarakana\widgets\Timeline::widget(['items' => $items]); ?>