jeskew / datetimeinterface-shim
A shim for using PHP >=5.5's DateTimeInterface in a PHP >=5.3 application
0.1.0
2015-11-15 20:33 UTC
Requires
- php: >=5.3.0
- nesbot/carbon: ^1.21
Requires (Dev)
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2024-10-29 04:04:04 UTC
README
Stuck on PHP 5.3 or 5.4 but want to typehint against \DateTimeInterface
?
Install this package and use
the included DateTime class:
<?php use DateTimeCompat\DateTime; $now = new DateTime(); $fromFormat = DateTime::fromFormat('U', (string) time());
Already have an instance of \DateTime
? This package uses nesbot/carbon
under the hood, so all of its
convenience methods are available to you, including instance
:
DateTime::instance(new \DateTime) instanceof 'DateTimeInterface' === true