innmind/time 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

innmind/time

最新稳定版本:1.0.0

Composer 安装命令:

composer require innmind/time

包简介

Time manipulation

README 文档

README

Build Status codecov Type Coverage

This library allows you to handle time down to the millisecond. The point was to also be explicit for every component of dates, this is why every php magic strings have been converted into objects.

All objects are immutable.

Installation

composer require innmind/time

Usage

Accessing time

use Innmind\Time\{
    Clock,
    Point,
    Format,
};
use Innmind\Immutable\Attempt;

$clock = Clock::live();
$now = $clock->now(); // return an instance of Point
echo $now->toString(); // 2016-10-11T12:17:30.123456+02:00

$epoch = $clock->at(
    '1970-01-01T00:00:00.000000+00:00',
    Format::iso8601(),
); // Attempt<Point>

Here we reference 2 points in time, the first is the exact moment we call now down to the microsecond and the second one is the epoch time.

The method at() accepts any string that is allowed by \DateTimeImmutable.

Halt process

use Innmind\Time\{
    Halt
    Period,
};

function yourApp(Halt $halt): void
{
    // do something
    $halt(Period::minute(42))->unwrap();
    // do some more
}

yourApp(Halt::new());

This example will halt your program for 42 minutes.

Logging

use Innmind\Time\Halt;
use Psr\Log\LoggerInterface;

$halt = Halt::logger($halt, /** an instance of LoggerInterface */);

## Documentation

Full documentation is available at <https://innmind.org/time/>.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固