PHPackages                             doctrineum/datetime-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. [Database &amp; ORM](/categories/database)
4. /
5. doctrineum/datetime-immutable

Abandoned → [doctrine/dbal](/?search=doctrine%2Fdbal)Library[Database &amp; ORM](/categories/database)

doctrineum/datetime-immutable
=============================

DateTimeImmutable as a type for Doctrine - abandoned as doctrine/dba already implement this

2.1.0(7y ago)01.5kMITPHPPHP &gt;=7.1

Since Feb 19Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (7)Versions (7)Used By (0)

[![Test Coverage](https://camo.githubusercontent.com/96eb1a81dce9e8fe562d9cbe5df94b1ce8aaded88c25b1ef938dc8b2263bbb24/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6a61726f736c61767479632f646f637472696e65756d2d6461746574696d652d696d6d757461626c652f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/jaroslavtyc/doctrineum-datetime-immutable/coverage)[![License](https://camo.githubusercontent.com/9e152f4762efbe19019db224df78a41d34cbfb0b186d87c72aab21e4c5ac6731/68747470733a2f2f706f7365722e707567782e6f72672f646f637472696e65756d2f6461746574696d652d696d6d757461626c652f6c6963656e7365)](https://packagist.org/packages/doctrineum/datetime-immutable)

Deprecated
==========

[](#deprecated)

**Use [Doctrine\\DBAL\\Types\\DateTimeImmuable](https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Types/DateTimeImmutableType.php) instead.**

Do you need it?
---------------

[](#do-you-need-it)

- first of all, think twice if you need a new type into your application
    - isn't [Doctrine\\DBAL\\Types\\DateTime](http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/cookbook/working-with-datetime.html) enough?
- on the other side, immutable object of any time can save you a lot of problems and time...

Usage
=====

[](#usage)

- register it

```
\Doctrineum\DateTimeImmutable\DateTimeImmutableType::registerSelf();
```

- use it

```
use Doctrine\ORM\Mapping as ORM;

class Foo {
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    private $id;
    /**
     * @ORM\Column(type="datetime-immutable")
     */
    private $when;

    public function __construct(\DateTimeImmutable $when)
    {
        $this->when = $when;
    }
}
```

```
\Doctrineum\DateTimeImmutable\DateTimeImmutableType::registerSelf();

$foo = new Foo(new \DateTimeImmutable());
// ...
$entityManager->persist($foo);
$entityManager->flush();
```

Common pitfalls
---------------

[](#common-pitfalls)

Be aware of timezone which is not persisted and therefore can not be restored on fetch. Doctrine uses [server default timezone](http://php.net/manual/en/function.date-default-timezone-get.php) for it. For details and most of all, for solution, see [Doctrine docs](http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/cookbook/working-with-datetime.html#handling-different-timezones-with-the-datetime-type)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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

Recently: every ~128 days

Total

6

Last Release

2853d ago

Major Versions

1.0.x-dev → 2.0.02017-02-19

PHP version history (3 changes)1.0.0PHP &gt;=5.6

2.0.0PHP &gt;=7.0

2.1.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e35d11c9a75584084f0dc0ba1a3b6ff03355777809cbe8eabd20a88ac00f794?d=identicon)[jaroslavtyc](/maintainers/jaroslavtyc)

---

Top Contributors

[![jaroslavtyc](https://avatars.githubusercontent.com/u/2290225?v=4)](https://github.com/jaroslavtyc "jaroslavtyc (24 commits)")

---

Tags

doctrinedatetimeimmutable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/doctrineum-datetime-immutable/health.svg)

```
[![Health](https://phpackages.com/badges/doctrineum-datetime-immutable/health.svg)](https://phpackages.com/packages/doctrineum-datetime-immutable)
```

###  Alternatives

[carbonphp/carbon-doctrine-types

Types to use Carbon in Doctrine

213220.4M8](/packages/carbonphp-carbon-doctrine-types)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M35](/packages/scienta-doctrine-json-functions)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4485.3M4](/packages/martin-georgiev-postgresql-for-doctrine)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[vasek-purchart/doctrine-date-time-immutable-types

Doctrine DateTimeImmutable types

42228.3k](/packages/vasek-purchart-doctrine-date-time-immutable-types)

PHPackages © 2026

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