Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pizar/carbon-it-holidays
Carbon Support for IT Holidays
https://github.com/pizar/carbon-it-holidays
carbon carbon-support composer date holiday italian
Last synced: about 8 hours ago
JSON representation
Carbon Support for IT Holidays
- Host: GitHub
- URL: https://github.com/pizar/carbon-it-holidays
- Owner: pizar
- License: mit
- Created: 2019-01-09T18:12:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-13T06:35:22.000Z (7 months ago)
- Last Synced: 2024-10-30T12:51:26.534Z (20 days ago)
- Topics: carbon, carbon-support, composer, date, holiday, italian
- Language: PHP
- Size: 8.79 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Carbon Support for IT Holidays
This extends [Carbon](http://carbon.nesbot.com/) and adds support for several IT holidays.I start from this repo: https://github.com/geoffreyrose/us-holidays and i customize for italian calendar
### Supported Holidays
* New Years Day
* Epiphany
* Easter
* Easter Monday
* Liberation Day
* Labour Day
* Republic day
* Assumption of Mary
* All Saints' Day
* Immaculate Conception Day
* Christmas Day
* St. Stephen's Day### Requirements
* [Carbon](http://carbon.nesbot.com/)
* PHP 8.1+### Usage
#### With Composer
```
$ composer require pizar/carbon-it-holidays
``````php
isHoliday(); // bool (true)
```Get name if date is holiday. Returns `string` or `false`
```php
$carbon = new Carbon();
$carbon = Carbon::create(2018, 12, 31);
$carbon->getHolidayName(); // New Year's Eve
```Get date for a specific holiday. Returns `string`
```php
$carbon = new Carbon();
$carbon = Carbon::create(2018, 1, 1);$carbon->getNewYearsDayHoliday(); // 2019-01-01 00:00:00
$carbon->getEpiphanyHoliday(); // 2019-01-06 00:00:00
$carbon->getEasterMondayHoliday(); // 2019-04-22 00:00:00
$carbon->getLiberationDayHoliday(); // 2018-04-25 00:00:00
$carbon->getLabourDayHoliday(); // 2018-05-01 00:00:00
$carbon->getRepublicDayHoliday(); // 2018-06-02 00:00:00
$carbon->getAssumptionOfMaryHoliday(); // 2018-08-15 00:00:00
$carbon->getFerragosto(); // 2018-08-15 00:00:00
$carbon->getAllSaintsDayHoliday(); // 2018-11-01 00:00:00
$carbon->getImmaculateConceptionDayHoliday(); // 2018-12-08 00:00:00
$carbon->getChristmasDayHoliday(); // 2018-12-25 00:00:00
$carbon->getStStephenDayHoliday(); // 2018-12-26 00:00:00```
see https://github.com/geoffreyrose/us-holidays for other examples too