Clock - A PHP 7.0 compatible clock abstraction

Overview

Clock

A PHP 7.0 compatible clock abstraction.

Current version Supported PHP version Monthly Downloads Total Downloads Tests Discord

Installation

composer require kreait/clock

Basic usage



require 'vendor/autoload.php';

use Kreait\Clock\FrozenClock;
use Kreait\Clock\SystemClock;

$systemClock = new SystemClock(new DateTimeZone('UTC'));
var_dump($systemClock->now());

$frozenClock = new FrozenClock(new DateTimeImmutable('2019-08-20 10:41:53'));
var_dump($frozenClock->now());

$frozenClock->setTo(new DateTimeImmutable('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.

You might also like...
The fastest way to make a powerful JSON:API compatible Rest API with Laravel.
The fastest way to make a powerful JSON:API compatible Rest API with Laravel.

The first fully customizable Laravel JSON:API builder. "CRUD" and protect your resources with 0 (zero) extra line of code. Installation You can instal

Algolia Search integration for Magento 1 - compatible with versions from 1.6.x to 1.9.x

Algolia Search for Magento 1.6+ End of Support 🚨 The Algolia Magento 1 extension has reached End of Life regarding support and maintenance. We do not

[ONLY Magento 2.0.x Compatible] Code samples for Magento developers

Synopsis This project is a collection of samples to demonstrate technologies introduced in Magento 2. You will find the most simple extension along wi

Algolia Search integration for Magento 2 - compatible with versions from 2.3.x to 2.4.x

Algolia Search for Magento 2 🔎 Need help? Check out our Technical Troubleshooting Guide. For feedback, bug reporting, or unresolved issues with the e

Faker-driven, configuration-based, platform-agnostic, locale-compatible data faker tool
Faker-driven, configuration-based, platform-agnostic, locale-compatible data faker tool

Masquerade Faker-driven, platform-agnostic, locale-compatible data faker tool Point Masquerade to a database, give it a rule-set defined in YAML and M

TiDB is an open source distributed HTAP database compatible with the MySQL protocol
TiDB is an open source distributed HTAP database compatible with the MySQL protocol

What is TiDB? TiDB ("Ti" stands for Titanium) is an open-source NewSQL database that supports Hybrid Transactional and Analytical Processing (HTAP) wo

Pika is a nosql compatible with redis, it is developed by Qihoo's DBA and infrastructure team
Pika is a nosql compatible with redis, it is developed by Qihoo's DBA and infrastructure team

Introduction中文 Pika is a persistent huge storage service , compatible with the vast majority of redis interfaces (details), including string, hash, li

A plugin to make Nextcloud compatible with Solid

solid-nextcloud A plugin to make Nextcloud compatible with Solid.

Allows installing Drupal extensions event if not compatible with installed drupal/core package

mglaman/composer-drupal-lenient Lenient with it, Drupal 10 with it. Why? The Drupal community introduced a lenient Composer facade that modified the d

Comments
  • Implement forward compatible Clock-Interface

    Implement forward compatible Clock-Interface

    The stella-maris/clock package provides an interface based on the currently proposed status of PSR20. Due to the inactivity of the PSR20 working group this is a way to already provide interoperability while still maintaining forward compatibility. When the current status of PSR20 will be released at one point in time the stella-maris/clock package will extend the PSR20 interface so that this package becomes immeadiately PSR20 compatible without any further work necessary. In the long run the stella-maris/clock package will then be marked deprecated so that people can then use the PSR20 provided implementation.

    Should the implementation of PSR20 change between now and a possible release then this interface will still exist and a possible implementation will need more code-changes anyhow so this interface will still provide some way of interoperability.

    opened by heiglandreas 2
Releases(1.2)
Owner
kreait
kreait
Steins;Gate Divergence Meter Clock/VisitorCounter

This is a html inspired bySteins;Gate Divergence Meter Clock/VisitorCounter( THE Name is not decide))

null 5 Jul 13, 2022
Lightweight abstraction layer for payment gateways

Slickpay is lightweight abstraction layer for payment gateways. Documentation Documentation for Slickpay can be found on official website. Licence The

Slickpay 31 Oct 26, 2021
Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer

Spot DataMapper ORM v2.0 Spot v2.x is built on the Doctrine DBAL, and targets PHP 5.4+. The aim of Spot is to be a lightweight DataMapper alternative

Spot ORM 602 Dec 27, 2022
This component, based on the Symfony serializer and async-aws, is a human-readable and quick abstraction to easily store serialized objects in DynamoDB 🚀.

DynamoDB Storable This component, based on the Symfony serializer and async-aws, is a human-readable and quick abstraction to easily store serialized

Matthieu W. 2 Jun 19, 2022
A small, modern, PSR-7 compatible PSR-17 and PSR-18 network library for PHP, inspired by Go's net package.

Net A small, modern, PSR-7 compatible PSR-17 and PSR-18 network library for PHP, inspired by Go's net package. Features: No hard dependencies; Favours

Minibase 16 Jun 7, 2022
A small, modern, PSR-7 compatible PSR-17 and PSR-18 network library for PHP, inspired by Go's net package.

Net A small, modern, PSR-7 compatible PSR-17 and PSR-18 network library for PHP, inspired by Go's net package. Features: No hard dependencies; Favours

Minibase 16 Jun 7, 2022
Couleur is a modern PHP 8.1+ color library, intended to be compatible with CSS Color Module Level 4.

?? Couleur: A modern PHP 8.1+ color library ?? Couleur: A modern PHP 8.1+ color library ?? Presentation ⚙️ Installation ?? Quick Start ?? Usage ?? Imm

Matthieu Masta Denis 3 Oct 26, 2022
Check if files are compatible with X version of PHP.

grumphp-php-compatibility Check if files are compatible with X version of PHP. grumphp.yml: parameters: tasks: php_compatibility:

Wunder 4 Mar 15, 2022
A simple social groups compatible with ActivityPub.

A simple social groups compatible with ActivityPub.

wxw.moe 23 Dec 2, 2022
Laravel Blog Package. Easiest way to add a blog to your Laravel website. A package which adds wordpress functionality to your website and is compatible with laravel 8.

Laravel Blog Have you worked with Wordpress? Developers call this package wordpress-like laravel blog. Give our package a Star to support us ⭐ ?? Inst

Binshops 279 Dec 28, 2022