承接 technodelight/seconds-to-none 相关项目开发

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

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

technodelight/seconds-to-none

Composer 安装命令:

composer require technodelight/seconds-to-none

包简介

Seconds to human / human to seconds

README 文档

README

Seconds to human / human to seconds

This is a very minimal library to allow conversion between human time duration representation and time in seconds. Usage:

$converter = new \Technodelight\SecondsToNone;
$textRepresentation = $converter->secondsToHuman(12345);
// => '3 hours 25 minutes 45 seconds'
$seconds = $converter->humanToSeconds('3 hours 25 minutes 45 seconds');
// => 12345

If you want, you can configure how the representations are looking like.

$config = new Technodelight\SecondsToNone\Config(['h' => 3600, 'm' => 60, 's' => 1, 'none' => 0]);
// above secondsToHuman output with the following config:
// 3 h 25 m 45 s

Or the above with a more precise look:

$config = new Technodelight\SecondsToNone\Config(['h' => 3600, 'm' => 60, 's' => 1, 'none' => 0], '%d%s');
// above secondsToHuman output with the following config:
// 3h 25m 45s

You can even swap the order by using a custom pattern:

$config = new Technodelight\SecondsToNone\Config(['h' => 3600, 'm' => 60, 's' => 1, 'none' => 0], '%2$ss%1$d');
// above secondsToHuman output with the following config:
// h3 m25 s45

This micro-library also comes with tests!

License

The MIT License (MIT)

Copyright (c) 2016 Zsolt Gál

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

统计信息

  • 总下载量: 1.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固