navarr / specific-time

An implementation of PSR-20 providing a clock that stands still in time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Specific Time (PSR-20)

Latest Stable Version Total Downloads Latest Unstable Version License
Tests Code Coverage Mutation score

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');

About

An implementation of PSR-20 providing a clock that stands still in time

License:MIT License


Languages

Language:PHP 85.7%Language:Shell 14.3%