mic2100/fuzzy-time 问题修复 & 功能扩展

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

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

mic2100/fuzzy-time

Composer 安装命令:

composer require mic2100/fuzzy-time

包简介

A fuzzy time calculator

关键字:

README 文档

README

This was inspired from the fuzzy time clock that exists on Ubuntu. It gives you a rough idea what the time is without you knowing the exact minutes.

i.e. quarter past nine or half past two

Installation

composer require mic2100/fuzzy-time

Usage

use Mic2100\FuzzyTime\GeneratorAwareTrait;
use Mic2100\FuzzyTime\GeneratorFactory;
use Mic2100\FuzzyTime\Language\Dictionaries\English;
use Mic2100\FuzzyTime\Language\Dictionaries\German;
use Mic2100\FuzzyTime\Language\LanguageFactory;

date_default_timezone_set('Europe/London');

$factory = new GeneratorFactory();
$english = $factory->get(); //or $factory->get(LanguageFactory::get(English::HANDLE);  
$german = $factory->get(LanguageFactory::get(German::HANDLE));

class SampleClass
{
    use GeneratorAwareTrait;
}

$traitClass = new SampleClass();

while (true) {
    echo $english->getFuzzyTime() . PHP_EOL;
    echo $german->getFuzzyTime() . PHP_EOL;
    echo $traitClass->getFuzzyTime((new DateTime('-25 MINS'))) . PHP_EOL;
    sleep(30);
}

/*----------------------------------------------
 * Example Output
 *
 * five to one //$english->getFuzzyTime()
 * fünf vor ein //$german->getFuzzyTime()
 * half to twelve //$traitClass->getFuzzyTime((new DateTime('-25 MINS')), LanguageFactory::get(English::HANDLE))
 *
 * or
 *
 * three o'clock //$english->getFuzzyTime()
 * drei uhr //$german->getFuzzyTime()
 * twenty five to three //$traitClass->getFuzzyTime((new DateTime('-25 MINS')), LanguageFactory::get(English::HANDLE))
 */

The LanguageFactory DOES NOT have to be used if you only want to use English because this is the default language

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固