Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Duration Laravel Package

khill/php-duration

A PHP library for parsing and formatting durations. Turn strings like "1h 30m" or "2 days" into seconds, and convert seconds back into readable, human-friendly duration strings, with support for localization.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Canonical duration format: Decide whether the product stores durations as integer seconds and formats them as HH:MM:SS or human-readable strings only at the edges. This package can support that normalization in Laravel/PHP services and admin tools.
  • Build vs. buy for small utilities: Avoid spending roadmap time building basic duration parsing/formatting if the need is narrow. Use the package to validate a feature quickly, then wrap it behind an internal adapter if it becomes broadly used.
  • Feature scoping for time-based UX: Accelerate MVPs for time tracking, scheduling displays, media duration display, SLA countdowns, import/export cleanup, and reporting where users enter or see durations.
  • API and data-contract decisions: Define where each format is allowed: integer seconds for storage/APIs, colon format for machine-friendly display, and human-readable format for customer-facing UI. The package helps expose the tradeoffs quickly.
  • Localization and precision decisions: Use it only if English-like human-readable output is acceptable. If the roadmap requires localized duration strings, ISO 8601 durations, timezone-aware scheduling, or fractional precision, decide early to build on Carbon/native date intervals instead.
  • Dependency-risk decisions: Because the package is small, MIT-licensed, and easily forked, a PM can treat it as a tactical utility rather than a strategic platform dependency—provided the team accepts ownership if upstream maintenance stops.

When to Consider This Package

  • Consider it when a Laravel/PHP product needs simple conversion between seconds, colon-formatted durations, and human-readable strings, with no calendar arithmetic or timezone logic.
  • Good fit for internal tools, admin panels, prototypes, MVPs, data-import cleanup, and low-risk display formatting where speed matters more than long-term dependency prestige.
  • Adopt only with a containment plan: pin the version, add representative tests, wrap calls behind an application-specific service/interface, and be prepared to fork or replace it.
  • Look elsewhere when the product needs timezone-aware scheduling, date arithmetic, ISO 8601 duration support, localization, fractional seconds, payroll/compliance-grade accuracy, or active vendor maintenance.
  • Be cautious as a long-term core dependency: the last release was in 2021, dependents are reported as zero, and ecosystem validation is thin. Treat that as a signal to avoid deep coupling, not necessarily an automatic rejection for a small internal utility.

How to Pitch It (Stakeholders)

  • For executives: This is a small MIT-licensed utility that can speed up delivery of duration-related UX and reduce custom code for formatting/parsing time. It is not a strategic platform bet, and the risk is containable because it can be wrapped, forked, or replaced.
  • For engineering: Use it as an implementation detail behind an internal duration service, not scattered across controllers/views. Run a short spike, add tests for expected formats and edge cases, pin the dependency, and document the fallback plan.
  • Recommendation: Trial it for narrow, low-risk duration conversion work; avoid making it a load-bearing dependency for scheduling, billing, compliance, or localization-heavy experiences without an explicit owner and replacement path.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons