bretterer/iso_duration_converter
Lightweight PHP helper to convert ISO 8601 duration strings (e.g., PT1H30M, P2DT3H) into usable values like seconds or formatted time. Handy for parsing API durations, validating inputs, and normalizing durations in Laravel or any PHP app.
PT15M, P1DT2H) across APIs, reducing ambiguity in time-related user inputs (e.g., scheduling, timeouts, or duration fields).Adopt this package if:
PT1H30M, P2D) from user input, APIs, or external systems.Look elsewhere if:
Carbon or DateTime.spatie/iso-8601-duration).DateInterval) over third-party packages.For Executives:
"This lightweight PHP package solves a common pain point: reliably parsing ISO 8601 duration strings (like PT15M or P1DT2H) into usable time values. It’s ideal for APIs needing to validate or process time-based inputs—think scheduling, timeouts, or user-submitted durations. With zero dependencies and minimal setup, it’s a low-risk way to standardize how we handle time data, reducing bugs and improving compatibility with external systems. The trade-off? It’s not actively maintained, but given its simplicity, the risk is low for our use case."
For Engineers:
*"bretterer/iso_duration_converter is a no-frills way to convert ISO 8601 durations (e.g., PT1H30M) into seconds/minutes/hours. Perfect for:
P2D for max job runtime).Pros:
✅ Tiny footprint, easy to integrate.
✅ Handles common patterns like P…T… reliably.
✅ Works seamlessly in Laravel or vanilla PHP.
Cons: ⚠️ Last updated in 2016 (but stable for basic use cases). ⚠️ Limited to seconds/minutes/hours/days (no years/months).
Recommendation: Use it for timeouts/scheduling if you need ISO 8601 parsing. For broader date/time needs, pair with Carbon."*
How can I help you explore Laravel packages today?