承接 ebene7/php-clock 相关项目开发

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

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

ebene7/php-clock

Composer 安装命令:

composer require ebene7/php-clock

包简介

E7 PHP clock

README 文档

README

Provides a simple abstraction of a clock, following the suggestion by Martin Fowler.

Installation

Package is available on Packagist, you can install it using Composer.

$ composer require ebene7/php-clock

Basic usage

SystemClock

Create a SystemClock object and simply use it! Object that will return the current time based on the given timezone

<?php

use E7\Clock\SystemClock;

$clock = new SystemClock();
$now = $clock->now();

It's also possible to set the timezone.

<?php

use DateTimeZone;
use E7\Clock\SystemClock;

$timezone = new DateTimeZone('Europe/Berlin');
$clock = new SystemClock(timezone);
$now = $clock->now();

FrozenClock

The FrozenClock simplfies testing and it's also esy to use. The FrozenClock object always returns a fixed time object.

<?php

use DateTimeImmutable;
use E7\Clock\FrozenClock;

$now = new DateTimeImmutable();
$clock = new FrozenClock($now);
$now = $clock->now();

Credits

This project is inspired by lcobucci/clock (originally licensed under MIT by Luís Cobucci).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2020-07-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固