dcarbone/gotime
Go-inspired time utilities for PHP 8.1+: a Duration type (parse/format like 5s, JSON as nanoseconds) plus helpers to generate DateInterval specs for DateTime add/sub. Includes a Time wrapper around DateTime aiming for Go time.Time-style APIs.
Full Changelog: https://github.com/dcarbone/gotime/compare/v1.0.0...v1.0.1
Full Changelog: https://github.com/dcarbone/gotime/compare/v0.6.1...v1.0.0
Full Changelog: https://github.com/dcarbone/gotime/compare/v0.6.0...v0.6.1
Full Changelog: https://github.com/dcarbone/gotime/compare/v0.5.1...v0.6.0
jsonSerialize method on Weekday, Month, and Duration classes to : mixed to support downstream overloadingRemoved :int typehint on jsonSerialize method to allow for more flexible overloading of the json representation of the Duration type.
Time class:
UntilUntilDateTimeSinceSinceDateTime\DateInterval type to Time\Duration typeTime\Time::Nanoseconds() methodTime::Duration method to provide "cast"-like abilities with strings, integers, floats, and instances of DurationThis release does little functionally other than enforce strict typing package-wide and adjust the formatting slightly.
Version iterated in case users were using lazy typing.
Addresses issue where a zero Duration would be returned when using Time::ParseDuration with value containing > 1 decimal point of precision (i.e. Time::ParseDuration('0.05s');)
Time\Time::getErrorString now correctly returns the formatted error string. Before, the output was ignored.
Using the string format of microtime() over the float value to prevent issues with float -> string casting.
This release turns Time\Time::AddDuration and Time\Time::SubDuration into fluent methods, and some test cases around this.
Fixes issue with float value parsing in duration strings.
Added api-compatible Duration::Truncate() and Duration::Round() methods, as well as Duration::Compare() to help the with the fact that this is not go.
Also added some tests.
This initial release includes a simplified implementation of time.Duration and some basic documentation.
How can I help you explore Laravel packages today?