承接 nehlsen/time-formatter-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Require the library
    composer require nehlsen/time-formatter
  2. 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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-28