Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

welearn-GmbH/clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Composer

Better use https://symfony.com/doc/current/components/clock.html as it's symfony standard!

welearn/clock

A simple implementation of the upcoming PSR-20 clock.

Installation

composer require welearn/clock

Or see https://packagist.org/packages/welearn/clock

For symfony

Add to services.yaml to allow the service being wired.

Welearn\Clock\ClockInterface:
    class: Welearn\Clock\Clock

For your unittests you can use mocks against Welearn\Clock\ClockInterface (the interface will be replaced with the PSR interface at one point!). Alternatively you can also create the FrozenClock with a specific date and time or Clock manually.

Clock implementations

Clock

Returns the current date as an DateTimeImmutable when calling now.

FrozenClock

Allows to set a date through contructor which is always returned when calling now.

About

PSR-20 compliant clock

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages