Releases: stevegrunwell/time-constants
Version 2.0.2
- Use the
const
keyword instead ofdefine()
for slight performance gains, easier readability, and better IDE interoperability. Props @ChadSikorra and @ramsey for the recommendation! (#23)
Version 2.0.1
- Now that constants are namespaced, remove the
defined()
checks and unnecessary multiplication in order to a) help IDEs and b) remove an (albeit tiny) level of overhead (#21)
Version 2.0.0
- Introduce a Makefile for running dev commands (#17)
- Move the constants from the global namespace into the
TimeConstants
namespace (#18) - Switch from PHP-CS-Fixer to PHP_CodeSniffer with the PHPCompatibility ruleset (#19)
- With this change, we can run one version of PHPUnit in CI, using PHP_CodeSniffer to detect any backwards compatibility breaks with this (admittedly simply) library
- With only one version of PHPUnit necessary, tests have been upgraded for PHPUnit 11.x
Breaking changes
This release moves the constants defined by this package from the global namespace into the TimeConstants
namespace.
Your implementations of these constants can be updated in either of the following ways:
- Explicitly import the constant(s) being used:
use const TimeConstants\HOUR_IN_SECONDS;
- Update references to use the constants new, fully-qualified names:
- cache($key, $value, HOUR_IN_SECONDS); + cache($key, $value, \TimeConstants\HOUR_IN_SECONDS);
Temporary aliases to help with migration
Alternatively, you may include the new GlobalAliases.php
file as a short-term fix. This file will take the newly-namespaced constants and also define them in the global namespace.
Either of the following approaches will ensure the aliased versions are loaded:
- (Preferred) Add the file to your
composer.json
file in theautoload.files
array:"autoload": { "files": [ "vendor/stevegrunwell/time-constants/src/GlobalAliases.php" ] }
- Explicitly requiring the file:
require_once __DIR__ . '/vendor/autoload.php'; + require_once __DIR__ . '/vendor/stevegrunwell/time-constants/src/GlobalAliases.php';
Please note that this GlobalAliases.php
file will be removed in the next major release (e.g. v3.x
) of this library.
Version 1.2.0
- Add the following multipliers to help with sub-second timings (#13):
MILLISECONDS_PER_SECOND
(1,000ms/s)MICROSECONDS_PER_SECOND
(1,000,000µs/s)NANOSECONDS_PER_SECOND
(1,000,000,000ns/s)PICOSECONDS_PER_SECOND
(1,000,000,000,000ps/s)
- Remove the composer.lock file, overhaul CI pipeline so tests can be run across all supported versions of PHP (#14, props @peter279k).
- Define an
archive.exclude
section incomposer.json
(#15).
Version 1.1.2
Version 1.1.1
- Fixed a copy+paste error in the comment for
ONE_MINUTE
. - Add namespacing to the tests, minimum PHP version to
composer.json
(#5, props @peter279k). - Added PHP 7.4 to the Travis CI build matrix.
Version 1.1.0
Version 1.0.0
First release of the package, containing 11 constants:
Time based in seconds
MINUTE_IN_SECONDS
(60 seconds)HOUR_IN_SECONDS
(3600 seconds)DAY_IN_SECONDS
(86,400 seconds)WEEK_IN_SECONDS
(604,800 seconds)MONTH_IN_SECONDS
(2,592,000 seconds)YEAR_IN_SECONDS
(31,536,000 seconds)
Time based in minutes
HOUR_IN_MINUTES
(60 minutes)DAY_IN_MINUTES
(1,440 minutes)WEEK_IN_MINUTES
(10,080 minutes)MONTH_IN_MINUTES
(43,200 minutes)YEAR_IN_MINUTES
(525,600 minutes)