一个PHP组件,用于判断今天是否是特定的一天。

dev-master 2020-07-01 19:26 UTC

This package is auto-updated.

Last update: 2024-08-29 04:37:22 UTC


README

Tests

Today组件提供了PHP面向对象库,用于判断今天是否是特定的一天、工作日、假日、当前季节等...

安装

Today使用Composer。

composer require matthieumota/today

用法

<?php

require __DIR__.'/vendor/autoload.php';

use MatthieuMota\Component\Today\Today;

$today = new Today();
// You can back to the past to see if it was an amazing day.
// $today = new Today(new \DateTime('1985-10-21'));

$today->getHolidays(); // Return array with all holidays.
$today->isHoliday(); // True if today is holiday

$today->getSeason(); // Return current season : winter, spring, summer or autumn

备注

此组件处于开发中,不稳定。另外,请注意,由于不需要支持多时区,只有法国的假日被硬编码,但一个文档齐全且经过测试的PR可以被合并。