PHPackages                             nickjbedford/calendar-timer - 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. nickjbedford/calendar-timer

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

nickjbedford/calendar-timer
===========================

Provides classes to calculate past and future schedule dates based on a reference date.

0.3.0(3mo ago)095MITPHPPHP &gt;=8.4

Since Feb 16Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/nickjbedford/calendar-timer)[ Packagist](https://packagist.org/packages/nickjbedford/calendar-timer)[ Docs](https://github.com/nickjbedford/calendar-timer)[ RSS](/packages/nickjbedford-calendar-timer/feed)WikiDiscussions main Synced today

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

YetAnother\\CalendarTimer
=========================

[](#yetanothercalendartimer)

Provides day, month and year-based calendar schedule calculation. For each type of timer, a reference date along with an interval is used to calculate past and future dates, from any date including now.

For example, to calculate a fortnightly schedule of dates from Wednesday 6th January 2021, you can use the following code:

```
use \YetAnother\DayTimer;

$scheduler = new DayTimer('2021-01-04', 14);

// get next 3 dates from 1st February 2021
$dates = $scheduler->getDates(3, '2021-02-01');

// $dates = [
//   '2021-02-03'
//   '2021-02-17'
//   '2021-03-03'
// ]
```

Alternatively you can use the provided helper methods to create calendar timer. These create instances of the `DayTimer`, `MonthTimer`or `YearTimer` subclasses depending on the helper.

```
use \YetAnother\CalendarTimer;

$date = '2020-01-04';

$weekly = CalendarTimer::weekly($date);
$fortnightly = CalendarTimer::fortnightly($date);
$monthly = CalendarTimer::monthly($date);
$biannual = CalendarTimer::sixMonthly($date);
$yearly = CalendarTimer::yearly($date);
```

YetAnother\\ScheduleFinder
==========================

[](#yetanotherschedulefinder)

The `ScheduleFinder` class can be used to find the next or previous date in a configuration for "available" workdays across a calendar year while also specifying holiday dates to exclude.

### Use Case Example

[](#use-case-example)

A business may only want to ship orders on Mondays, Wednesdays and Fridays but also prefer to only ship on the 5th, 15th and 25th days of each month. This class helps you discover the next most appropriate shipping date based on a reference date, allowing for an optional "earliest-date".

#### Example 1a

[](#example-1a)

- Standard workdays are Monday to Friday.
- Today is the Monday 1st July 2024.
- A product doesn't need to be shipped until Thursday 11th July 2024.
- Preferred shipping days are Tuesdays and Fridays.

The `ScheduleFinder::closest(date: '2024-07-11', earliestDate: '2024-07-01')`method will choose Tuesday 9th July 2024 as the preferred shipping day.

#### Example 1b

[](#example-1b)

- It turns out tuesday 9th July is a public holiday.
- The next best workday is Monday 10th July 2024.

### Examples

[](#examples)

```
use YetAnother\ScheduleFinder;
use YetAnother\Weekday;
use YetAnother\ScheduleAlgorithm;

$schedule = new ScheduleFinder(
    standardWorkdays: [ Weekday::Monday, Weekday::Wednesday, Weekday::Friday ],
    holidays: [ '2024-06-17' ],
    preferredCalendar: ScheduleFinder::createPreferredCalendar([ 5, 15, 25 ]),
    algorithm: ScheduleAlgorithm::ClosestWorkday);

/**
 * '2024-06-05' Tuesday because 5th is a Wednesday so the next
 * available calendar date.
 */
$schedule->nextAsString(from: '2024-06-04');

/**
 * '2024-06-14' Friday because 15th is a Saturday so the "closest workday"
 * (not before 6th June) is the Friday before the 15th.
 */
$schedule->nextAsString(from: '2024-06-06');

/**
 * '2024-06-19' Wednesday because the 17th (Monday) is a holiday. The 15th is
 * a Saturday so the next available workday is the Wednesday after the 17th.
 */
$schedule->nextAsString(from: '2024-06-15');

/**
 * '2024-06-24' Monday because the 25th (Tuesday) is not a workday so the closest
 * workday (not before 17th June) is the Monday before the 25th.
 */
$schedule->nextAsString(from: '2024-06-17');

/**
 * '2024-06-26' Wednesday because the 25th (Tuesday) is not a workday
 * so the closest workday (not before 25th June) is the Wednesday after the 25th.
 */
$schedule->nextAsString(from: '2024-06-25');
```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance81

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Recently: every ~140 days

Total

11

Last Release

102d ago

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

0.2.0PHP &gt;=8.3

0.3.0PHP &gt;=8.4

### Community

Maintainers

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

---

Top Contributors

[![nickjbedford](https://avatars.githubusercontent.com/u/10795658?v=4)](https://github.com/nickjbedford "nickjbedford (1 commits)")

---

Tags

scheduletimercalendarscheduling

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nickjbedford-calendar-timer/health.svg)

```
[![Health](https://phpackages.com/badges/nickjbedford-calendar-timer/health.svg)](https://phpackages.com/packages/nickjbedford-calendar-timer)
```

###  Alternatives

[spatie/laravel-google-calendar

Manage events on a Google Calendar

1.4k1.5M21](/packages/spatie-laravel-google-calendar)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[laraveljutsu/zap

A flexible, performant, and developer-friendly schedule management system for Laravel

1.4k69.1k](/packages/laraveljutsu-zap)[indeev/laravel-schedule-calendar

Laravel Schedule Calendar - a package providing developers with a concise and visual representation of scheduled tasks, enabling easy analysis of load distribution throughout the day or week for optimized task scheduling.

557.7k](/packages/indeev-laravel-schedule-calendar)[calendart/office365-adapter

Office365 Adapter for CalendArt

1213.8k](/packages/calendart-office365-adapter)[kriss/yii2-calendar-schedule

Yii2 Calendar Schedule

107.9k](/packages/kriss-yii2-calendar-schedule)

PHPackages © 2026

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