utrodus/malaysia-public-holiday
Composer 安装命令:
composer require utrodus/malaysia-public-holiday
包简介
A PHP library to crawl Malaysia public holidays with filtering and caching.
README 文档
README
Malaysia Public Holiday is a PHP library to fetch official public holiday data for all Malaysian states by scraping Office Holidays.
It’s best for HR applications, attendance systems, logistics planning, calendars, and any system that needs accurate holiday information.
✨ Features
- 📆 Get national and regional holidays in Malaysia
- 🌍 Support for all Malaysian states and federal territories
- 📅 Filter holidays by year, month, or state
- 🔁 Supports alias names for states (e.g.,
KL,Johore,Malacca) - ⚙️ Easily integrable with any PHP project
💼 Use Cases
- Employee attendance and HR systems
- Delivery scheduling & logistics
- Custom calendar generation
- Event planning & automation
- Working-day calculations
🚀 Requirements
- PHP >= 8.1
- Composer
🛠️ Tech Stack
| Tool | Purpose |
|---|---|
| PHP >= 8.1 | Core programming language |
| Guzzle | HTTP requests |
| Symfony BrowserKit | Web scraping (HTML crawling) |
| PHPUnit | Unit testing |
| GitHub Actions | Continuous integration |
📦 Installation
composer require utrodus/malaysia-public-holiday
⚡ Usage
<?php use MalaysiaHoliday\MalaysiaHoliday; $holiday = new MalaysiaHoliday(); // Get holidays for all states in the current year $result = $holiday->fromAllState()->get(); header('Content-Type: application/json'); echo json_encode($result, JSON_PRETTY_PRINT) . PHP_EOL; /** * Get formatted holiday data * with formatHolidayData method you can easier read and access * */ echo "------------------------------------------------" . PHP_EOL; echo "Formatted Holiday Data:" . PHP_EOL; $formatted = $holiday->formatHolidayData($result); echo $formatted . PHP_EOL;
I have included code examples to try this library in each file within the examples folder. Please see below:
| Use Case | Example File | Description |
|---|---|---|
| Get holidays for a specific state | examples/get_holidays_for_specific_state.php |
Retrieves holidays for a particular state in the current year. |
| Get holidays for a specific state and year | examples/get_holidays_for_specific_state_and_year.php |
Fetches holidays for a state in a specific year. |
| Get holidays for all states | examples/get_holidays_for_all_states.php |
Retrieves holidays for all Malaysian states in the current year. |
| Get holidays for all states and a specific year | examples/get_holidays_for_all_states_and_year.php |
Fetches holidays for all states in a given year. |
| Filter holidays by month | examples/get_holidays_for_state_filtered_by_month.php |
Filters holidays for a state in a specific month. |
| Group holidays by month | examples/get_holidays_for_state_grouped_by_month.php |
Groups holidays for a state by month. |
| Handling invalid regions | examples/handling_invalid_region.php |
Demonstrates how the library handles invalid region inputs. |
| Using alternative region names | examples/using_alternative_region_name.php |
Shows support for alias state names. |
🧪 Running Tests
vendor/bin/phpunit tests
📬 Contributing
Pull requests and suggestions are welcome! If you find bugs or have a feature request, feel free to open an issue.
📄 License
This project is open-source and available under the MIT License.
utrodus/malaysia-public-holiday 适用场景与选型建议
utrodus/malaysia-public-holiday 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 134 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「crawler」 「holiday」 「crawl」 「Malaysia」 「public holiday」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 utrodus/malaysia-public-holiday 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 utrodus/malaysia-public-holiday 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 utrodus/malaysia-public-holiday 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A lightweight, dependency free PHP class that acts as wrapper for Crawlbase API
Check for holidays - localeaware
Sitemap crawler/generator. For the given URL it will return sitemap XML file with URLs and images.
A basic wrapper for citco/carbon which returns business days between two given dates.
Your Package Description here
统计信息
- 总下载量: 134
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-19