michalmanko/php-library-holiday 问题修复 & 功能扩展

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

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

michalmanko/php-library-holiday

最新稳定版本:1.1.0

Composer 安装命令:

composer require michalmanko/php-library-holiday

包简介

A library to calculate holidays

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Dependency Status

Latest Stable Version Latest Unstable Version

License Total Downloads Monthly Downloads

Michalmanko/Holiday is a small library to check if a specified date is a holiday in a specific country.

Requirements

Michalmanko/Holiday requires PHP 5.3.23 or later.

Installation

Composer

The easiest way to install this library is through composer. Just add the following lines to your composer.json file:

{
   "require": {
        "michalmanko/php-library-holiday": "~1.1.0"
    }
}

Manually

Another way would be to download this library and configure the autoloading yourself. This library relies on a PSR-4 compatible autoloader for automatic class loading.

Usage

Get a provider

$providerByIso = \Michalmanko\Holiday\HolidayFactory::createProvider('PL');
$providerByCountry = \Michalmanko\Holiday\HolidayFactory::createProvider('Poland');
$providerByClassName = \Michalmanko\Holiday\HolidayFactory::createProvider('\\Michalmanko\\Holiday\\Provider\\Poland');

You can select provider by two-letter ISO-3166-1 country codes, country name or just a class name.

Check holidays

To check for holidays just create the provider for specific country and call the getHolidays method.

$provider = \Michalmanko\Holiday\HolidayFactory::createProvider('PL');
$holidays = $provider->getHolidays(new \DateTime('2014-01-01'));

If you just need to know if there is a holiday on your date or time period there are isHoliday and hasHolidays methods, too.

If you need to know all holidays for a specific country you can call the getHolidaysByYear method.

License

Michalmanko\Holiday is licensed under the MIT License, see the LICENSE.md file for more details.

Changelog

See the CHANGELOG.md file for more details.

Contributing

Michalmanko/Holiday is open source. Everyone is more than welcome to contribute more of them. If you use this library it would be great to get some support for currently not implemented countries which you are familiar with. Pull requests will be reviewed and merged fast.

To create a new Provider please see the \Michalmanko\Holiday\Provider\Poland class as an example.

Running Tests

Run a php composer install command in the base directory to install the phpunit dependency. After that you can simply call vendor/bin/phpunit -c phpunit.xml.dist to run the test suite.

统计信息

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

GitHub 信息

  • Stars: 21
  • Watchers: 3
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-07-18