effectra / clock
Effectra Clock 包。
v1.0.0
2023-06-19 13:34 UTC
Requires
- php: ^8.0.2
- psr/clock: ^1.0
README
这是一个名为 Effectra\Clock
的 PHP 类,它实现了 Psr\Clock\Clock
接口。它为 PHP 应用程序提供了一个简单且标准的获取当前时间和时间戳的方法。
特性
- 实现了
Psr\Clock\ClockInterface
接口 - 提供了
now()
方法,用于获取当前时间作为DateTimeImmutable
对象 - 提供了
timestamp()
方法,用于获取当前时间戳作为整数
用法
// Create a new instance of the Clock class $clock = new \Effectra\Clock\Clock(); // Get the current time as a DateTimeImmutable object $currentDateTime = $clock->now(); // Get the current timestamp as an integer $currentTimestamp = $clock->timestamp();
贡献
欢迎贡献!如果您遇到任何问题或有改进建议,请随时提交拉取请求或在 GitHub 仓库中打开一个问题。
许可证
此包是开源的,可在 MIT 许可证 下使用。 "# clock"