Skip to content
/ clock Public

Provides a simple PSR-20 implementation for reading date and time from the system clock in PHP.

License

Notifications You must be signed in to change notification settings

bebehr/clock

Repository files navigation

clock

Provides a simple PSR-20 implementation for reading date and time from the system clock in PHP.

Installing

composer require bebehr/clock

Usage

use Bebehr\Clock\FrozenClock;
use Bebehr\Clock\SystemClock;

// SystemClock
$clock = new SystemClock();
$dateTime  = $clock->now();
$timeStamp = $clock->now()->getTimestamp();

// FrozenClock
$mockClock = new FrozenClock(new DateTimeImmutable(
    'now',
    new DateTimeZone('Europe/Berlin'),
));
$mockDateTime  = $mockClock->now();
$mockTimeStamp = $mockClock->now()->getTimestamp();

About

Provides a simple PSR-20 implementation for reading date and time from the system clock in PHP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages