PHPackages                             srtfisher/time-iterator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. srtfisher/time-iterator

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

srtfisher/time-iterator
=======================

0.0.2(10y ago)210MITPHPPHP &gt;=5.5.9

Since Dec 8Pushed 10y agoCompare

[ Source](https://github.com/srtfisher/time-iterator)[ Packagist](https://packagist.org/packages/srtfisher/time-iterator)[ Docs](http://github.com/srtfisher/time-iterator)[ RSS](/packages/srtfisher-time-iterator/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

[![Build Status](https://camo.githubusercontent.com/4ea48a5b938c25cbe871a5dd8f07ecc0f74c003a9a9ad27caed7afa4b4084d8c/68747470733a2f2f7472617669732d63692e6f72672f7372746669736865722f74696d652d6974657261746f722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/srtfisher/time-iterator)

Time Iterator
=============

[](#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.

Authors
-------

[](#authors)

Maintained by [Sean Fisher](https://github.com/srtfisher).

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

[](#installation)

Install via Composer

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

Usage
-----

[](#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
----------------

[](#handling-of-time)

When setting the callback, we pass a `$start` and an `$end` arguments. Those arguments are [Carbon](https://github.com/briannesbitt/Carbon) objects. Carbon is a class built off of PHP's `DateTime` but with better methods to handle time more efficiently.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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 ~612 days

Total

2

Last Release

3975d ago

PHP version history (2 changes)0.0.1PHP &gt;=5.3.0

0.0.2PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/338d27065b1074f2d66d049d742f22996dd137eef6f91bc8f75350ceee1e8ef2?d=identicon)[srtfisher](/maintainers/srtfisher)

---

Top Contributors

[![srtfisher](https://avatars.githubusercontent.com/u/346399?v=4)](https://github.com/srtfisher "srtfisher (14 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/srtfisher-time-iterator/health.svg)

```
[![Health](https://phpackages.com/badges/srtfisher-time-iterator/health.svg)](https://phpackages.com/packages/srtfisher-time-iterator)
```

###  Alternatives

[illuminate/support

The Illuminate Support package.

630113.0M40.5k](/packages/illuminate-support)[spatie/holidays

Calculate public holidays

402860.1k2](/packages/spatie-holidays)[craftcms/feed-me

Import content from XML, RSS, CSV or JSON feeds into entries, categories, Craft Commerce products, and more.

293952.6k30](/packages/craftcms-feed-me)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k17](/packages/solspace-craft-freeform)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

46855.5k5](/packages/pimcore-data-importer)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)

PHPackages © 2026

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