A PHP internals RFC thread proposing a new `Time\Duration` class for PHP 8.6, targeting 'stopwatch' or 'egg-timer' style durations to improve developer experience for timeout APIs. The class uses a seconds + nanoseconds internal representation (similar to Rust's and Java's Duration), supports constructors up to hours, and parses ISO-8601 period strings starting with 'PT'. The RFC is intentionally minimal to meet the PHP 8.6 feature freeze deadline and serve as the foundation for a modernized date/time API. Discussion covers design decisions including omitting floating-point conversion methods, namespace choice (Time vs DateTime), ISO 8601 string serialization, and whether to use the temporal_rs Rust library as a backend (rejected due to integration complexity).

20m read timeFrom externals.io
Post cover image
241 Impressions