marwelln/holiday
Composer 安装命令:
composer require marwelln/holiday
包简介
Know when a holiday occours in Sweden
README 文档
README
This class requires PHP 7.1.
Installation
For PHP 7.1 and later:
composer require marwelln/holiday:~2.0
About
This class helps you know when holidays occours in Sweden. You can either get all holidays in an iterable Marwelln\Holiday\Collection or check when a specific holiday occours. All results returns a DateTime object that you can use to format the date the way you want it.
Usage
// Get all holidays as a `Marwelln\Holiday\Collection`.
$holidays = (new \Marwelln\Holiday)->get($year); // `$year` can be removed if you want to use current year.
$holidays = (new \Marwelln\Holiday)->year($year)->get();
// Check when easter occours.
$easter = (new \Marwelln\Holiday)->when('easter'); // 27 mars, as of 2016 (current year)
$easter = (new \Marwelln\Holiday)->year(2015)->when('easter'); // 5 april
// Get holidays between two dates.
$holidays = (new \Marwelln\Holiday)->between(new \DateTime('2015-01-01'), new \DateTime('2015-03-24')); // Collection of holidays
// Format the collection.
$holidays = (new \Marwelln\Holiday)->get();
$formatted = $holidays->map(function($holiday){
return [
'id' => $holiday['id'],
'date' => $holiday['date']->format('Y-m-d'),
'name' => trans('holiday.' . $holiday['id']), // Custom function from Laravel
'onWeekend' => in_array($holiday['date']->format('N'), [6, 7])
];
}, $holidays);
Available holidays
- newyearseve (nyårsafton)
- newyearsday (nyårsdagen)
- epiphany (trettondedag jul)
- easter (påskdagen)
- goodfriday (långfredagen)
- eastermonday (annandag påsk)
- ascensionday (kristi himmelfärdsdag)
- pentecostday (pingstdagen)
- mayday (första maj)
- swedishnationalday (svenska nationaldagen)
- midsummereve (midsommarafton)
- midsummerday (midsommardagen)
- allsaintsday (alla helgons dag)
- christmaseve (julafton)
- christmasday (juldagen)
- boxingday (annandag jul)
marwelln/holiday 适用场景与选型建议
marwelln/holiday 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 64 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 07 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 marwelln/holiday 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 marwelln/holiday 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 64
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-10