citco/carbon
Composer 安装命令:
composer require citco/carbon
包简介
This is a wrapper for nesbot/carbon which also calculates which days are British bank holidays (England & Wales only).
README 文档
README
This is a wrapper for Carbon which also calculates which days are British bank holidays (England & Wales only).
Installation
With Composer
$ composer require citco/carbon
{
"require": {
"citco/carbon": "*"
}
}
<?php require 'vendor/autoload.php'; use Citco\Carbon; echo "Today is ", (new Carbon)->isBankHoliday() ?: "not bank holiday";
Without Composer
Why are you not using composer? Download Carbon.php from the repo and save the file into your project path somewhere. (You also need to download nesbot/carbon)
<?php require 'path/to/nesbot/Carbon.php'; require 'path/to/citco/Carbon.php'; use Citco\Carbon; echo "Today is ", (new Carbon)->isBankHoliday() ?: "not bank holiday";
Sample code
Here are some samples on using this class:
// Creates a new instance of the class $c = new Carbon(); // Today's date $c = new Carbon('2012-05-21'); // Date as string $c = Carbon::parse('First day of May 2011'); // Checks if the given date is bank holiday $boolean = $c->isBankHoliday('2016-05-21'); $boolean = $c->isBankHoliday(Carbon::parse('First day of 2000')); // Returns array of holidays for the given year $c->getBankHolidays(2015); $c->getBankHolidays(array(2010, 2012)); $c->getBankHolidays(Carbon::now()); // Returns New Year date of the given year $c->getNewYearBankHoliday(2012); // 2012-01-02 // Without any parameter will return date for the init year $c->getNewYearBankHoliday(); $c->getGoodFridayBankHoliday(); $c->getEasterMondayBankHoliday(); $c->getEarlyMayBankHoliday(); $c->getSpringBankHoliday(); $c->getSummerBankHoliday(); $c->getBoxingDayBankHoliday(); $c->getChristmasBankHoliday(); // Returns next/previous bank holiday $c->nextBankHoliday(); $c->previousBankHoliday(); $c->nextBankHoliday(Carbon::parse('Next year May 1st')); $c->previousBankHoliday(Carbon::parse('Next year May 1st')); // Returns N next/previous bank holidays $n = 20; $c->nextBankHolidays($n); $c->previousBankHolidays($n); $c->nextBankHolidays($n, Carbon::parse('Next year May 1st')); $c->previousBankHolidays($n, Carbon::parse('Next year May 1st')); // Returns the list of bank holidays between two dates $start = Carbon::now(); $end = Carbon::now()->subYear(1); $holidays = $start->bankHolidaysSince($end);
Issues
Bug reports and feature requests can be submitted on the Github Issue Tracker.
Requirements
PHP 8.1 or above (For older PHP versions, please use the version 1.x or 2.x of this package)
License
Bank Holidays is licensed under the MIT License - see the LICENSE file for details
citco/carbon 适用场景与选型建议
citco/carbon 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 418.49k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2015 年 10 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Bank」 「holiday」 「holidays」 「british」 「england」 「wales」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 citco/carbon 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 citco/carbon 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 citco/carbon 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony integration for Czech bank account library
Check for holidays - localeaware
Extended DateTime and Date classes (extending DateTimeImmutable), DateTimeRange and DateRange classes
A basic wrapper for citco/carbon which returns business days between two given dates.
Iranian payment gateways handler for laravel applicationss
Your Package Description here
统计信息
- 总下载量: 418.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 27
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-20