dkvhin / ph-holidays
从菲律宾政府网站抓取假日信息
v1.0.6
2024-08-09 14:11 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- nesbot/carbon: ^2.7|^3.0
Requires (Dev)
- pestphp/pest: ^2.35
- phpstan/phpstan: ^1.11
README
此包可以从官方网站https://www.officialgazette.gov.ph/nationwide-holidays/抓取常规假日和特别假日
注意:由于网站使用了机器人检测器(cloudflare),这可能在使用生产环境时导致错误,目前尚未完全100%正常工作。
use Dkvhin\PhHolidays\PhilippineHolidays; // for the current year $holidays = PhilippineHolidays::fetch(); // returns an array of regular holidays $regular = $holidays->regular(); // returns an array of special holidays $special = $holidays->special();
安装
您可以通过composer安装此包
composer require dkvhin/ph-holidays
用法
use Dkvhin\PhHolidays\PhilippineHolidays; // for the current year $holidays = PhilippineHolidays::fetch(); // you can also pass specific year // NOTE that the website only provides the last 6 years worth of holidays // Advance year are not always available from the website // eg. ( current year is 2024, holidays for 2025 might not be available yet until the end of the year) $holidays = PhilippineHolidays::fetch(2022);
测试
composer test
致谢
许可证
MIT许可证(MIT)。更多信息请参阅许可证文件。