michalmanko/php-library-holiday
Composer 安装命令:
composer require michalmanko/php-library-holiday
包简介
A library to calculate holidays
README 文档
README
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.
michalmanko/php-library-holiday 适用场景与选型建议
michalmanko/php-library-holiday 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 81.09k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2014 年 07 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「holiday」 「polish holidays」 「danish holidays」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 michalmanko/php-library-holiday 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 michalmanko/php-library-holiday 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 michalmanko/php-library-holiday 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony bundle with validators for Polish identification numbers: PESEL, NIP, REGON, PWZ.
Check for holidays - localeaware
Extended DateTime and Date classes (extending DateTimeImmutable), DateTimeRange and DateRange classes
Polish Validators for Laravel
A basic wrapper for citco/carbon which returns business days between two given dates.
Modern PHP 8.3+ library for validating and parsing Polish identification numbers (PESEL, NIP, REGON, KRS, NRB, VAT-EU, IBAN, ID Card, Passport).
统计信息
- 总下载量: 81.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 21
- 点击次数: 28
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-07-18