承接 szalayk/datehuman 相关项目开发

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

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

szalayk/datehuman

最新稳定版本:v1.0.0

Composer 安装命令:

composer require szalayk/datehuman

包简介

Human-readable time difference in multiple languages (e.g. '3 hours ago', 'in 2 days').

README 文档

README

A lightweight PHP library for human-readable time differences, supporting past and future and multiple languages (English, Hungarian, Italian).

Installation

composer require szalayk/datehuman

Usage

<?php
require 'vendor/autoload.php';

use Szalayk\DateHuman\DateHuman;

$dh = new DateHuman('hu');
echo $dh->diff('2025-11-01 14:00:00'); // "2 napja"
echo $dh->diff('2025-11-05 14:00:00'); // "2 nap múlva"

$dh->setLanguage('it');
echo $dh->diff(strtotime('-3 hours'));  // "3 ore fa"

Supported languages

  • English (en)
  • Hungarian (hu)
  • Italian (it)

You can easily add more languages by creating a new file in src/Lang/ following the same structure.

License

MIT License © 2025 Krisztián Szalay.

统计信息

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

GitHub 信息

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

其他信息

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