2017 © Pedro Peláez
 

library time-iterator

image

srtfisher/time-iterator

  • Thursday, August 13, 2015
  • by srtfisher
  • Repository
  • 0 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Time Iterator

Making it easier to pull in data for intervals of time over a period of time. This was built so that it would be easier to build graphs that show changes over time for a specific period., (*2)

Authors

Maintained by Sean Fisher., (*3)

Installation

Install via Composer, (*4)

{
    "require": {
        "srtfisher/time-iterator": "0.0.2"
    },
}

Usage

use Srtfisher\TimeIterator;

$iterate = new TimeIterator;

// Set the Start date for five months ago
$iterate->setStart(60*60*24*7*5);

// Set the Interval to go over as 24 hours
$iterate->setInterval(60*60*24);

$iterate->setCallback(function(Carbon $start, Carbon $end, TimeIterator $object) {
    // Perform some logic here
    $object->addResults(array(
        'data' => true,
        // ....
    ));
});

// Run it
$iterate->run();

// Now, you can treat the object as an array
foreach ($iterate as $key => $data) {
    // Do something with the data...
}

Handling of Time

When setting the callback, we pass a $start and an $end arguments. Those arguments are Carbon objects. Carbon is a class built off of PHP's DateTime but with better methods to handle time more efficiently., (*5)

The Versions

13/08 2015

dev-master

9999999-dev http://github.com/srtfisher/time-iterator

  Sources   Download

MIT

The Requires

 

The Development Requires

13/08 2015

0.0.2

0.0.2.0 http://github.com/srtfisher/time-iterator

  Sources   Download

MIT

The Requires

 

The Development Requires

08/12 2013

0.0.1

0.0.1.0 http://github.com/srtfisher/time-iterator

  Sources   Download

MIT

The Requires

 

The Development Requires