PHPackages                             tomasfejfar/datetime-strict - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. tomasfejfar/datetime-strict

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

tomasfejfar/datetime-strict
===========================

Simple DateTime wrapper allowing strict date and time validation

0.2(9y ago)01031MITPHPPHP &gt;=5.5

Since Oct 10Pushed 9y ago1 watchersCompare

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

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

datetime-strict
===============

[](#datetime-strict)

[![Build Status](https://camo.githubusercontent.com/0c410e8abbef8f54a9f9b421e9a3601efff07851867907f9ad85d084c91e938c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f6d617366656a6661722f6461746574696d652d7374726963742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tomasfejfar/datetime-strict)[![Coverage Status](https://camo.githubusercontent.com/7501f12d6aa46a0f32708938fea0b4d8b45100416187a5c287fd43ef4ec40f6e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f746f6d617366656a6661722f6461746574696d652d7374726963742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/tomasfejfar/datetime-strict?branch=master)[![Total Downloads](https://camo.githubusercontent.com/94b3e617e1f4f2661acf84dedf148a897d59c7b4e5b7215afa34c7c01d5e240d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6d617366656a6661722f6461746574696d652d7374726963742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tomasfejfar/datetime-strict)[![Latest Version on Packagist](https://camo.githubusercontent.com/5a88425de8824d53115d8eb8909263a309119aa27fb1ff7c38f580a7afd6faf7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6d617366656a6661722f6461746574696d652d7374726963742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tomasfejfar/datetime-strict)[![Average time to resolve an issue](https://camo.githubusercontent.com/dd8cc762113970f37d00a9c9162571c21a961d256c3a9d5ecc9011270f91e377/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f7265736f6c7574696f6e2f746f6d617366656a6661722f6461746574696d652d7374726963742e737667)](http://isitmaintained.com/project/tomasfejfar/datetime-strict "Average time to resolve an issue")[![Percentage of issues still open](https://camo.githubusercontent.com/ed51b9e70379ac9a69e545cddcf09044f295717e1ac12335b6b24fd5db1311ff/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f6f70656e2f746f6d617366656a6661722f6461746574696d652d7374726963742e737667)](http://isitmaintained.com/project/tomasfejfar/datetime-strict "Percentage of issues still open")

Simple wrapper around DateTime to allow strict datetime validation

Install via Composer
--------------------

[](#install-via-composer)

```
composer require tomasfejfar/datetime-strict
```

Usage
-----

[](#usage)

```
use TomasFejfar\DateTime\DateTimeStrict;
use TomasFejfar\DateTime\StrictFormatException;

try {
    $date = DateTimeStrict::createFromFormat('Y-m-d H:i:s', '2001-33-05 13:35:08');
} catch (StrictFormatException $e) {
    $warnings = $e->getWarnings();
    $errors = $e->getErrors();
}
```

Usage for immutable variant is the same, just use `DateTimeImmutableStrict::createFromFormat()` instead.

Changelog
---------

[](#changelog)

Changes can be found in each tag's annotation

Rules for contributing
----------------------

[](#rules-for-contributing)

- **1 PR per feature**
- PR with tests are more likely to be merged
- **tests and coding standard must pass**

```
composer test
composer phpcs
```

**Happy coding**!

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.3% 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 ~56 days

Total

2

Last Release

3441d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fe74f7d626c19cc8812f926fbf18a8d84e71636b656b6ad00acc8fd105dd5ac3?d=identicon)[tomasfejfar](/maintainers/tomasfejfar)

---

Top Contributors

[![tomasfejfar](https://avatars.githubusercontent.com/u/642928?v=4)](https://github.com/tomasfejfar "tomasfejfar (26 commits)")[![aautar](https://avatars.githubusercontent.com/u/12861733?v=4)](https://github.com/aautar "aautar (1 commits)")

---

Tags

validationdatetime

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/tomasfejfar-datetime-strict/health.svg)

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

###  Alternatives

[composer/semver

Version comparison library that offers utilities, version constraint parsing and validation.

3.3k489.6M671](/packages/composer-semver)[giggsey/libphonenumber-for-php

A library for parsing, formatting, storing and validating international phone numbers, a PHP Port of Google's libphonenumber.

5.0k148.7M415](/packages/giggsey-libphonenumber-for-php)[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M381](/packages/respect-validation)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M106](/packages/propaganistas-laravel-phone)[opis/json-schema

Json Schema Validator for PHP

64236.9M185](/packages/opis-json-schema)[giggsey/libphonenumber-for-php-lite

A lite version of giggsey/libphonenumber-for-php, which is a PHP Port of Google's libphonenumber

8412.9M47](/packages/giggsey-libphonenumber-for-php-lite)

PHPackages © 2026

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