navarr / specific-time
A static time and date implementation of PSR-20
Fund package maintenance!
v1.0.1
2025-10-06 20:49 UTC
Requires
- php: ^8.2
- psr/clock: ^1
Requires (Dev)
- infection/infection: ^0.31.0
- jetbrains/phpstorm-attributes: ^1.0
- phpstan/phpstan: ^2
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.6
Provides
This package is auto-updated.
Last update: 2026-03-06 21:35:47 UTC
README
This is an implementation of PSR-20 that provides a constant time, no matter how many times ->now() is called on the object.
Installation
composer require navarr/specific-time:^1
Usage
use DateTimeImmutable; use Navarr\SpecificTime\SpecificTime; // ... $date = new DateTimeImmutable('2021-02-20'); $clock = new SpecificTime($date); // 2021-02-20 echo $clock->now()->format('Y-m-d');