litipk / php-jiffy
This package is abandoned and no longer maintained.
No replacement package was suggested.
A library to handle precise timestamps the easy way.
1.4.0
2016-06-06 21:45 UTC
Requires
- php: >=5.5.0
Requires (Dev)
- ext-mongo: *
- ext-mongodb: *
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2024-01-07 19:55:16 UTC
README
Installation
composer require litipk/php-jiffy
Usage
The PHP Jiffy library provides the UniversalTimestamp
class, which allows you to record timestamps with milliseconds
and microseconds precision and to convert it to other "timestamp types" whenever you need to do it.
The supported PHP versions are 5.5, 5.6, 7.0 and HHVM.
<?php use Litipk\Jiffy\UniversalTimestamp; $now = UniversalTimestamp::now(); $fromDateTime = UniversalTimestamp::fromDateTimeInterface(new \DateTime()); $fromMongoDate = UniversalTimestamp::fromMongoDate(new \MongoDate());
Notice: The MongoDB related methods are only available when the mongo
or mongodb
extensions are loaded.
Integration with Doctrine
If you want to use Jiffy's UniversalTimesamp objects in your Doctrine models, you can use our adapter layers:
- Jiffy Universal Timestamps for MongoDB ODM
- Jiffy Universal Timestamps for Doctrine ORM : Work in progress.