PHPackages                             antnavdev/recurrence - 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. antnavdev/recurrence

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

antnavdev/recurrence
====================

Evaluate whether a recurring rule string is due on a given date.

v1.0.1(3mo ago)04MITPHPPHP ^8.2

Since Apr 13Pushed 3mo agoCompare

[ Source](https://github.com/AntNavDev/recurrence)[ Packagist](https://packagist.org/packages/antnavdev/recurrence)[ RSS](/packages/antnavdev-recurrence/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

antnavdev/recurrence
====================

[](#antnavdevrecurrence)

Evaluate whether a recurring rule string is due on a given date. Pure PHP 8.2+, no framework dependencies.

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

[](#installation)

```
composer require antnavdev/recurrence
```

Usage
-----

[](#usage)

```
use AntNavDev\Recurrence\Recurrence;
use Carbon\Carbon;

$recurrence = new Recurrence('weekly:mon,wed,fri');
$recurrence->isDueOn(Carbon::parse('2026-04-13')); // Monday → true
$recurrence->isDueOn(Carbon::parse('2026-04-14')); // Tuesday → false
```

For rules that require an anchor date (`biweekly` and `interval`), pass it as the second constructor argument:

```
$recurrence = new Recurrence('biweekly:mon', anchorDate: Carbon::parse('2025-01-06'));
$recurrence->isDueOn(Carbon::parse('2025-01-06')); // week 0 → true
$recurrence->isDueOn(Carbon::parse('2025-01-13')); // week 1 → false
$recurrence->isDueOn(Carbon::parse('2025-01-20')); // week 2 → true

$recurrence = new Recurrence('interval:7', anchorDate: Carbon::parse('2025-01-01'));
$recurrence->isDueOn(Carbon::parse('2025-01-01')); // day 0 → true
$recurrence->isDueOn(Carbon::parse('2025-01-08')); // day 7 → true
$recurrence->isDueOn(Carbon::parse('2025-01-09')); // day 8 → false
```

Rule format
-----------

[](#rule-format)

Rule stringMeaning`null`Every day (same as `daily`)`daily`Every day`weekly:mon,wed,fri`Specific days of the week (lowercase 3-letter codes)`biweekly:mon`Every other week on that day, anchored to `anchorDate``monthly:15`The 15th of each month`monthly:last`The last day of each month`interval:N`Every N days from `anchorDate` (N &lt; 1 is never due)Valid day-of-week codes: `mon`, `tue`, `wed`, `thu`, `fri`, `sat`, `sun`.

Exceptions
----------

[](#exceptions)

- `AntNavDev\Recurrence\InvalidRuleException` (extends `\InvalidArgumentException`) — thrown when the rule string cannot be parsed (e.g. `whenever:tuesday`, `monthly:foo`).
- `\LogicException` — thrown when `isDueOn()` is called with a `biweekly` or `interval` rule but no `anchorDate` was provided.

Running tests
-------------

[](#running-tests)

```
composer install
./vendor/bin/phpunit
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance81

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Total

2

Last Release

102d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16236453?v=4)[Anthony](/maintainers/AntNavDev)[@AntNavDev](https://github.com/AntNavDev)

---

Top Contributors

[![AntNavDev](https://avatars.githubusercontent.com/u/16236453?v=4)](https://github.com/AntNavDev "AntNavDev (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antnavdev-recurrence/health.svg)

```
[![Health](https://phpackages.com/badges/antnavdev-recurrence/health.svg)](https://phpackages.com/packages/antnavdev-recurrence)
```

###  Alternatives

[illuminate/support

The Illuminate Support package.

583113.0M42.8k](/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.6k34](/packages/craftcms-feed-me)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

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

Adds a comprehensive import functionality to Pimcore Datahub

47855.5k5](/packages/pimcore-data-importer)[japanese-date/japanese-date

日本の暦、祝日を取り扱うライブラリ

1610.0k](/packages/japanese-date-japanese-date)

PHPackages © 2026

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