PHPackages                             kschu91/date-range - 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. kschu91/date-range

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

kschu91/date-range
==================

A small PHP library to extract date ranges out of a list of dates.

122PHP

Since Oct 7Pushed 7y ago1 watchersCompare

[ Source](https://github.com/kschu91/date-range)[ Packagist](https://packagist.org/packages/kschu91/date-range)[ RSS](/packages/kschu91-date-range/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/922b66f841c0effb271378c4b0b92dfe2b3ce8aa1b373bdf3e2d1558fc767499/68747470733a2f2f7472617669732d63692e6f72672f6b7363687539312f646174652d72616e67652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kschu91/date-range)[![Code Coverage](https://camo.githubusercontent.com/08064d24eabf8bb6563da6483c69fb0b697a53fe5f200f9d5ed83ca94ca3f5e2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b7363687539312f646174652d72616e67652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kschu91/date-range/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e2737471a48b965d8b8715533ca22df2f11d0363d1ec79aea99dc6b564d3e667/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b7363687539312f646174652d72616e67652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kschu91/date-range/?branch=master)

PHP Date Range
==============

[](#php-date-range)

A small PHP library to extract date ranges out of a list of dates.

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

[](#installation)

```
composer require "kschu91/date-range"
```

If you are not familiar with composer: [composer basic usage](https://getcomposer.org/doc/01-basic-usage.md)

### Requirements

[](#requirements)

- PHP &gt;= 7.1

Basic Usage
-----------

[](#basic-usage)

```
$datePeriods = (new DateRangeInterval(new \DateInterval('P1D'), $dates))->getDatePeriods();
```

### Example

[](#example)

```
$dates = [
    new \DateTime('2018-09-02'),
    new \DateTime('2018-09-03'),
    new \DateTime('2018-09-04'),
    new \DateTime('2018-09-08'),
    new \DateTime('2018-10-02'),
    new \DateTime('2018-10-03'),
];

$range = new DateRangeInterval(new \DateInterval('P1D'), $dates);

$datePeriods = $range->getDatePeriods();

foreach ($datePeriods as $datePeriod) {
    echo $datePeriod->start->format('Y-m-d') . ' - ' . $datePeriod->end->format('Y-m-d') . PHP_EOL;
}
```

will output:

```
2018-09-02 - 2018-09-04
2018-09-08 - 2018-09-08
2018-10-02 - 2018-10-03

```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/16a030944fdb6c9508d602db24db8f25023b76393295a19d206e586e686611b8?d=identicon)[kschu91](/maintainers/kschu91)

---

Top Contributors

[![kschu91](https://avatars.githubusercontent.com/u/5566756?v=4)](https://github.com/kschu91 "kschu91 (2 commits)")

### Embed Badge

![Health badge](/badges/kschu91-date-range/health.svg)

```
[![Health](https://phpackages.com/badges/kschu91-date-range/health.svg)](https://phpackages.com/packages/kschu91-date-range)
```

PHPackages © 2026

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