nehlsen/time-formatter-bundle
最新稳定版本:2.0.1
Composer 安装命令:
composer require nehlsen/time-formatter-bundle
包简介
Small Utility to format remaining time of something into a human-readable form
README 文档
README
Small Utility class to format remaining time of something into a human-readable form.
Example
Given Milk having a bestBefore Timestamp, we can calculate its remaining lifetime like so
/** @var Milk $myMilk */ $myMilk = $fridge->getMyMilk(); /** @var \DateTimeImmutable $bestBefore */ $bestBefore = $myMilk->getBestoBefore(); $secondsUntilBad = $bestBefore->getTimestamp() - time(); $formatter = new \nehlsen\TimeFormatterBundle\TimeFormatter\TimeFormatter(); $formattedBestBefore = $formatter->format($secondsUntilBad); // $formattedBestBefore == '3 Days 1 Hour 17 Seconds';
For a range of options and examples see example1.php
Installation
- Require the library
composer require nehlsen/time-formatter
- For the translations to work, the provided files can be used, copied, linked. But they are not enabled automatically.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-28