2017 © Pedro Peláez
 

library progress

A generator of Bootstrap 3 progress bars based on dates

image

ealore/progress

A generator of Bootstrap 3 progress bars based on dates

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Progress

A generator of Bootstrap 3 progress bars based on dates, (*2)

Installation

composer require ealore\progress

If you use Laravel 5 you may add the service provider to config/app.php providers array, (*3)

Ealore\Progress\ProgressServiceProvider::class,

Usage

$progress = new Ealore\Progress('2013-01-01','2013-12-31','P30D');
echo $progress->render(); // generate the html for the progress bar, based on the dates you provided.

The HTML generated looks like this:, (*4)

<div class="progress">
    <div class="progress-bar progress-bar-success" style="width: 31.24%"><span class="sr-only">31.24%</span></div>
    <div class="progress-bar progress-bar-warning" style="width: 2.81%"><span class="sr-only">2.81%</span></div>
    <div class="progress-bar progress-bar-danger" style="width: 65.95%"><span class="sr-only">65.95%</span></div>
</div>

You may use also setters:, (*5)

$progress = new Ealore\Progress\Progress;
$progress->setStartDate('2013-01-01');
$progress->setWarningThresholdAsDate('2013-12-01');
$progress->setEndDate('2013-12-31');

echo $progress->render();

Threshold of the 'warning' section

You may set a threshold to mark the start of the 'warning' section in two ways:, (*6)

  • as a date: $progress->setWarningThresholdAsDate('2014-12-01');, (*7)

  • as a string, following PHP's DateInterval format: $progress->setWarningThresholdAsString('P20D'); // 20 days, (*8)

  • as a percentage represented by a float value: $progress->setWarningThresholdAsString(25.0); // 25%, (*9)

Default values

When start and end are not set, the default values used are defined from the initialization timestamp: one month before for the start and next month for the end. By default the 'warning' section starts one month before the end. If start and end are not set this means that the 'warning' starts at the moment of initialization. The threshold may be removed completely by setting it to zero:, (*10)

$progress->setWarningThresholdAsString('P0D');

Take a look at the examples below, the last one shows the effect of setting the warning interval to zero., (*11)

Examples

Screenshot, (*12)

Contribution

PRs are welcome, (*13)

Roadmap

  • Create a more flexible setWarningThreshold method that accepts mixed parameters
  • Method documentation
  • Refactor tests

The Versions

03/01 2017

dev-master

9999999-dev https://github.com/Ealore/Progress

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires

 

laravel bootstrap generator carbon

07/12 2015

v1.1.6

1.1.6.0 https://github.com/Ealore/Progress

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires

 

laravel bootstrap generator carbon

07/12 2015

v1.1.5

1.1.5.0

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires

 

07/12 2015

v1.1.4

1.1.4.0

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires

 

06/12 2015

dev-screenshots

dev-screenshots

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires

 

06/12 2015

v1.1.3

1.1.3.0

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires

 

06/12 2015

v1.1.2

1.1.2.0

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires

 

06/12 2015

v1.1

1.1.0.0

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires

 

06/12 2015

v1.1.1

1.1.1.0

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires

 

05/12 2015

v1.0

1.0.0.0

A generator of Bootstrap 3 progress bars based on dates

  Sources   Download

MIT

The Requires