定制 n11t/holidays 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

n11t/holidays

Composer 安装命令:

composer require n11t/holidays

包简介

Service to calculate Holidays

README 文档

README

pipeline status coverage report

Holidays

Object oriented service to calculate holidays between given dates or check if given date is holiday. Can be extended by own providers.

Installation

Installing via Composer (recommended)

composer require n11t/holidays

Usage

<?php
require_once __DIR__ . '/vendor/autoload.php';

$calculator = new \N11t\Holidays\Country\Germany();

// Check if date is holiday
$calculator->isHoliday(new \DateTime('2018-12-24')); // True

// Get Holidays in Range
$calculator->between(new \DateTime('2018-03-26'), new \DateTime('2018-04-02')); // 2018-03-30, 2018-04-02

// Extend calculation by own providers
$calculator->isHoliday(new \DateTime('2018-03-01')); // False
$calculator->addProvider(new FirstOfMarchProvider());
$calculator->isHoliday(new \DateTime('2018-03-01')); // True

class FirstOfMarchProvider implements \N11t\Holidays\Calculator\Provider\HolidayProvider {
    public function getHolidays(int $year): \N11t\Holidays\Entity\HolidayCollection
    {
        $holidays = [
            new \N11t\Holidays\Entity\Holiday('2018-03-01', 'Funny Holiday')
        ];

        return new \N11t\Holidays\Entity\HolidayCollection(...$holidays);
    }
}

Tipp: Always use the \N11t\Holidays\HolidayCalculator interface as type-hint.

Supported States

Currently Germany and it's states are Supported. Feel free to contribute.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固