PHPackages                             hill-valley/fluxcap - 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. hill-valley/fluxcap

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

hill-valley/fluxcap
===================

Set of date-time related immutable classes

1.x-dev(2y ago)3923↓33.3%1MITPHPPHP ^8.1

Since Nov 28Pushed 2y ago2 watchersCompare

[ Source](https://github.com/hill-valley/fluxcap)[ Packagist](https://packagist.org/packages/hill-valley/fluxcap)[ RSS](/packages/hill-valley-fluxcap/feed)WikiDiscussions 1.x Synced 1mo ago

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

fluxcap
=======

[](#fluxcap)

This package contains:

- immutable classes `DateTime`, `Date` and `Time` (wrapping `\DateTimeImmutable`)
- immutable class `TimeZone` (wrapping `\DateTimeZone`)
- immutable class `Duration` (wrapping `\DateInterval`)
- enums `Month` and `Weekday`

[![Latest release](https://camo.githubusercontent.com/6492f5b131dfe7ae1211e569e219f4cf091039e35443eafb0130d4a0eef085cb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f68696c6c2d76616c6c65792f666c75786361703f736f72743d73656d766572267374796c653d666c61742d737175617265)](https://github.com/hill-valley/fluxcap/releases)[![PHP version requirement](https://camo.githubusercontent.com/dfa54bcee476808d358716a892d1bae1cb62b51075b88b8d2a463d83fa39567f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f68696c6c2d76616c6c65792f666c75786361703f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/dfa54bcee476808d358716a892d1bae1cb62b51075b88b8d2a463d83fa39567f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f68696c6c2d76616c6c65792f666c75786361703f7374796c653d666c61742d737175617265)[![Psalm type coverage](https://camo.githubusercontent.com/d864e4c15fed5f8ab02f07f981da678b9075c68ee0f68282c3408639af903031/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742d7371756172652675726c3d687474707325334125324625324673686570686572642e64657625324667697468756225324668696c6c2d76616c6c6579253246666c7578636170253246636f766572616765)](https://shepherd.dev/github/hill-valley/fluxcap)[![License](https://camo.githubusercontent.com/6e7da73f8c2559a4290ba1bed4e8bd14d3c8a3279914aed1d8b8a3515b43e5c2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f68696c6c2d76616c6c65792f666c75786361703f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/6e7da73f8c2559a4290ba1bed4e8bd14d3c8a3279914aed1d8b8a3515b43e5c2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f68696c6c2d76616c6c65792f666c75786361703f7374796c653d666c61742d737175617265)

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

[](#installation)

```
composer require hill-valley/fluxcap

```

Examples
--------

[](#examples)

### `DateTime`, `Date`, `Time`

[](#datetime-date-time)

```
use HillValley\Fluxcap\DateTime;
use HillValley\Fluxcap\Date;
use HillValley\Fluxcap\Time;
use HillValley\Fluxcap\TimeZone;

$dateTime = DateTime::now();
$dateTime = DateTime::fromString('2015-10-21 09:30:00');
$dateTime = DateTime::fromString('2015-10-21 09:30:00', TimeZone::fromString('Europe/Berlin'));
$dateTime = DateTime::fromFormat('d.m.Y H.i', '21.10.2015 09.30');
$dateTime = DateTime::fromParts(2015, 10, 21, 9, 30, 0);
$dateTime = DateTime::fromNative(new \DateTimeImmutable());

$date = Date::today();
$date = Date::fromString('2015-10-21');

$time = Time::now();
$time = Time::fromString('09:30:00');

$dateTime->getYear();
$dateTime->toIso(); // 2015-10-21T09:30:00.000000+02:00
$dateTime->format('d.m.Y, H:i');
$dateTime->formatIntl(\IntlDateFormatter::MEDIUM); // requires intl extension

$dateTime2 = $dateTime->addDays(3);
$date2 = $date->toLastDayOfMonth();
$date2 = $date->toFirstDayOfQuarter();

$dateTime->isPast();
$dateTime->equals($dateTime2);
$dateTime->lowerEquals($dateTime2);
$duration = $dateTime->diff($dateTime2);
```

### `Duration`

[](#duration)

```
use HillValley\Fluxcap\Duration;

$duration = Duration::fromString('P2DT5H');
$duration = Duration::fromParts(days: 2, hours: 5);
$duration = Duration::years(2);

$duration->toIso(); // P2DT5H
$duration->format('%d days');
$duration->getHours();
```

### `Month`, `Weekday`

[](#month-weekday)

```
use HillValley\Fluxcap\Month;
use HillValley\Fluxcap\Weekday;

$month = Month::October;

$weekdays = Weekday::cases();
$weekday = Weekday::Tuesday;

// same methods for months

$weekday->getName();
$weekday->getAbbreviation();

$weekday->getIntlName(); // via intl extension
$weekday->getIntlAbbreviation();

$count = $weekday->diffToNext(Weekday::Friday);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

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

Unknown

Total

1

Last Release

822d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ca17dd41359844b80757471e1cab70fd790de5e26615812562995fc7e7c1379?d=identicon)[gharlan](/maintainers/gharlan)

---

Top Contributors

[![gharlan](https://avatars.githubusercontent.com/u/330436?v=4)](https://github.com/gharlan "gharlan (18 commits)")

---

Tags

datedatetimeiso8601timedatetimetimedateiso8601

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hill-valley-fluxcap/health.svg)

```
[![Health](https://phpackages.com/badges/hill-valley-fluxcap/health.svg)](https://phpackages.com/packages/hill-valley-fluxcap)
```

###  Alternatives

[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)[kartik-v/php-date-formatter

A Javascript datetime formatting and manipulation library using PHP date-time formats.

461.5M3](/packages/kartik-v-php-date-formatter)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14282.3k](/packages/dater-dater)

PHPackages © 2026

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