PHPackages                             ordinary/clock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ordinary/clock

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ordinary/clock
==============

A simple PSR-20 Clock implementation for accessing and mocking the current time.

1.0.0(3y ago)1211↓50%1MITPHPPHP ^8.1

Since Nov 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/brandonja991/ordinary-clock)[ Packagist](https://packagist.org/packages/ordinary/clock)[ RSS](/packages/ordinary-clock/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (1)

Ordinary Clock
==============

[](#ordinary-clock)

A simple PSR-20 Clock implementation for accessing and mocking the current time.

Table of Contents
-----------------

[](#table-of-contents)

- [Getting Started](#getting-started)
- [Clocks](#clocks)
    - [`UTCClock`](#utcclock) - Provides UTC times. (Should be your primary clock used)
    - [`AlternateTimeZoneClock`](#alternatetimezoneclock) - Provides times in a specified timezone based on time from another clock.
    - [`FrozenClock`](#frozenclock) - Provides only the specified time. (Great for mocking and testing)
    - [`SystemClock`](#systemclock) - Provides times in the specified timezone. (Use at your own will)
- [`ClockInterface`](#clockinterface-methods)
    - [`now()`](#clockinterfacenow)
    - [`isBefore()`](#clockinterfaceisbeforedatetime)
    - [`isAfter()`](#clockinterfaceisafterdatetime)
    - [`isAtEarliest()`](#clockinterfaceisatearliestdatetime)-
    - [`isAtLatest()`](#clockinterfaceisatlatestdatetime)
    - [`isBetween()`](#clockinterfaceisbetweenstartdate-enddate)
    - [`isBetweenInclusive()`](#clockinterfaceisbetweeninclusivestartdate-enddate)
    - [`isBetweenInclusiveStart()`](#clockinterfaceisbetweeninclusivestartstartdate-enddate)

Getting Started
---------------

[](#getting-started)

```
composer require ordinary/clock
```

Usage
-----

[](#usage)

```
