Skip to content
This repository was archived by the owner on Jan 31, 2026. It is now read-only.
/clock-phpPublic archive

Repository files navigation

Warning

This package is no longer maintained. Use beste/clock instead.

Clock

A PHP 7.0 compatible clock abstraction.

Current versionSupported PHP versionMonthly DownloadsTotal DownloadsTestsDiscord

Installation

composer require kreait/clock

Basic usage

<?phprequire'vendor/autoload.php';
useKreait\Clock\FrozenClock;
useKreait\Clock\SystemClock;
$systemClock = newSystemClock(newDateTimeZone('UTC'));
var_dump($systemClock->now());
$frozenClock = newFrozenClock(newDateTimeImmutable('2019-08-20 10:41:53'));
var_dump($frozenClock->now());
$frozenClock->setTo(newDateTimeImmutable('2019-08-19 19:19:19'));
var_dump($frozenClock->now());

Credits

This project exists because lcobucci/clock (rightfully) doesn't support PHP 7.0 anymore, but we need a clock in kreait/firebase-php 4.x and kreait/firebase-tokens 1.x for backwards compatibility.

License

The MIT License (MIT). Please see License File for more information.

About

A PHP 7.0 compatible clock abstraction

Resources

Code of conduct

Security policy

Stars

96 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages