A PHP component to know if today is a particular day.

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

This package is auto-updated.

Last update: 2024-04-29 03:35:33 UTC


README

Tests

The Today component provides PHP Object Oriented library to know if today is a particular day, business-day, holiday, current season...

Installation

Today uses Composer.

composer require matthieumota/today

Usage

<?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

Notes

This component is work in progress, it's no stable. Also, you should note that only french holidays are hardcoded because it doesn't need to support multi zone, but a PR well documented and tested can be merged.