PHPackages                             thewilkybarkid/date-time-immutable - 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. thewilkybarkid/date-time-immutable

AbandonedArchivedLibrary

thewilkybarkid/date-time-immutable
==================================

Polyfill for the DateTimeImmutable class added in PHP 5.5.0

v1.0.2(11y ago)02.5k—9.1%1[2 issues](https://github.com/thewilkybarkid/date-time-immutable/issues)1MITPHPPHP &gt;=5.2.0

Since Nov 11Pushed 11y ago1 watchersCompare

[ Source](https://github.com/thewilkybarkid/date-time-immutable)[ Packagist](https://packagist.org/packages/thewilkybarkid/date-time-immutable)[ Docs](https://github.com/thewilkybarkid/date-time-immutable)[ RSS](/packages/thewilkybarkid-date-time-immutable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (1)

`DateTimeImmutable` polyfill
============================

[](#datetimeimmutable-polyfill)

[![Build Status](https://camo.githubusercontent.com/0aa540b0abd14f94463773d2445fe544698da5a61f787549255e12f986013938/68747470733a2f2f7472617669732d63692e6f72672f74686577696c6b796261726b69642f646174652d74696d652d696d6d757461626c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/thewilkybarkid/date-time-immutable)

This small library adds a polyfill for the `DateTimeImmutable` object introduced in PHP 5.5.0.

Authors
-------

[](#authors)

- Chris Wilkinson

It's partially based on Benjamin Eberlei's [Immutable DateTime Objects](http://www.whitewashing.de/2010/01/08/immutable-datetime-objects.html) blog post.

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

[](#installation)

```
$ php composer.phar require thewilkybarkid/date-time-immutable:~1.0

```

Basic usage
-----------

[](#basic-usage)

```
$dateTime = new DateTimeImmutable();
$newDateTime = $datetime->modify('+1 day');
var_dump($dateTime === $newDateTime); // output 'bool(false)'

```

Caveats
-------

[](#caveats)

PHP 5.5.0 also introduced a `DateTimeInterface` which both `DateTimeImmutable` and `DateTime` implement. In this polyfill we can't change the `DateTime` class, so `DateTimeImmutable` has to extend it. This is slightly dangerous as their behaviour is not compatible (see ).

PHP 5.6.0 added a `DateTimeImmutable::createFromMutable()` factory method, which this polyfill doesn't include.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

4216d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e6aaeba393e9038b5a5a916e5f4e32ffb349436e3be2027be4828f486bc8c9d?d=identicon)[thewilkybarkid](/maintainers/thewilkybarkid)

---

Top Contributors

[![thewilkybarkid](https://avatars.githubusercontent.com/u/1784740?v=4)](https://github.com/thewilkybarkid "thewilkybarkid (21 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thewilkybarkid-date-time-immutable/health.svg)

```
[![Health](https://phpackages.com/badges/thewilkybarkid-date-time-immutable/health.svg)](https://phpackages.com/packages/thewilkybarkid-date-time-immutable)
```

PHPackages © 2026

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