PHPackages                             smhg/date-frequency - 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. smhg/date-frequency

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

smhg/date-frequency
===================

Temporal frequency library

v4.0.3(1y ago)41.4kMITPHPPHP &gt;=8.1CI failing

Since Mar 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/smhg/date-frequency-php)[ Packagist](https://packagist.org/packages/smhg/date-frequency)[ RSS](/packages/smhg-date-frequency/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (3)Versions (21)Used By (0)

date-frequency-php [![CI](https://github.com/smhg/date-frequency-php/actions/workflows/php.yml/badge.svg)](https://github.com/smhg/date-frequency-php/actions/workflows/php.yml)
================================================================================================================================================================================

[](#date-frequency-php-)

> Temporal frequency library

PHP clone of [JavaScript version](https://github.com/smhg/date-frequency-js).

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

[](#installation)

```
$ composer require smhg/date-frequency
```

Methods
-------

[](#methods)

### Frequency

[](#frequency)

```
use Frequency\Frequency;

$frequency = new Frequency();
$frequency->on('day', 3, 'week')
	->on('hour', 10)
	->on('minute', 0)
	->on('seconds', 0); // every Wednesday at 10:00:00
```

#### Frequency(\[string rules\])

[](#frequencystring-rules)

#### Frequency(\[array rules\])

[](#frequencyarray-rules)

Pass rules as a string (see `__toString`) or an array to the constructor instead of setting them one-by-one with `on()`.

Example above as a string: `$frequency = new Frequency('F3D/WT10H0M0S');`

#### on(string unit, int|string value, \[string scope\])

[](#onstring-unit-intstring-value-string-scope)

Add a rule (fixed integer value or a string representing the name of a filter function) to the frequency for a unit, optionally linked to a scope (if not provided, a default scope is derived).

Filter functions need to be available in the static `Frequency::$fn` array when used.

Example filter: `$frequency = new Frequency('F(leap)Y1M1DT0H0M0S');` (Jan 1st, at midnight, of leap years)

See tests for more examples.

#### next(DateTime start = new DateTime())

[](#nextdatetime-start--new-datetime)

Get the next occurence of the frequency on or after a date.

#### between(DateTime start, DateTime end)

[](#betweendatetime-start-datetime-end)

Get all occurences of the frequency between 2 dates.

#### \_\_toString()

[](#__tostring)

Convert frequency to a string value.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance49

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

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

Recently: every ~438 days

Total

19

Last Release

369d ago

Major Versions

v0.3.1 → v1.0.02018-06-08

v1.1.0 → v2.0.02018-11-27

v2.0.0 → v3.0.02020-07-22

v3.0.0 → v4.0.02023-07-16

PHP version history (3 changes)0.1.0PHP &gt;=5.3.0

v2.0.0PHP &gt;=5.6

v4.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f5aff3cb1755a1fbf76ff89754e1ad996338a7ebfa1c24301f319a28938f517?d=identicon)[smhg](/maintainers/smhg)

---

Top Contributors

[![smhg](https://avatars.githubusercontent.com/u/2411348?v=4)](https://github.com/smhg "smhg (38 commits)")

---

Tags

timedatecronfrequencytemporal

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/smhg-date-frequency/health.svg)

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

###  Alternatives

[knplabs/knp-time-bundle

Making your dates and durations look sensible and descriptive

6308.9M39](/packages/knplabs-knp-time-bundle)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)[florianv/business

DateTime calculations in business hours

359775.9k1](/packages/florianv-business)

PHPackages © 2026

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