Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afiqiqmal/malaysiaholiday
Get list of holiday in Malaysia's Calendar
https://github.com/afiqiqmal/malaysiaholiday
api composer goutte hacktoberfest holiday laravel malaysia malaysia-holiday packagist php scraper
Last synced: 4 days ago
JSON representation
Get list of holiday in Malaysia's Calendar
- Host: GitHub
- URL: https://github.com/afiqiqmal/malaysiaholiday
- Owner: afiqiqmal
- License: mit
- Created: 2017-06-08T01:45:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-01-13T03:39:05.000Z (20 days ago)
- Last Synced: 2025-01-29T09:41:05.343Z (4 days ago)
- Topics: api, composer, goutte, hacktoberfest, holiday, laravel, malaysia, malaysia-holiday, packagist, php, scraper
- Language: PHP
- Homepage:
- Size: 210 KB
- Stars: 28
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Malaysia Holidays :airplane:
Parsing Malaysian Public Holidays[![Build Status](https://travis-ci.org/xmhafiz/MalaysiaHoliday.svg?branch=master)](https://travis-ci.org/afiqiqmal/MalaysiaHoliday)
[![Coverage](https://img.shields.io/codecov/c/github/afiqiqmal/MalaysiaHoliday.svg)](https://codecov.io/gh/afiqiqmal/MalaysiaHoliday)
[![Packagist](https://img.shields.io/packagist/dt/afiqiqmal/MalaysiaHoliday.svg)](https://packagist.org/packages/afiqiqmal/MalaysiaHoliday)
[![Packagist](https://img.shields.io/packagist/v/afiqiqmal/MalaysiaHoliday.svg)](https://packagist.org/packages/afiqiqmal/MalaysiaHoliday)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/paypalme/mhi9388?locale.x=en_US)![](https://banners.beyondco.de/Malaysia%20Holiday.png?theme=dark&packageName=afiqiqmal%2Fmalaysiaholiday&pattern=cage&style=style_1&description=Parsing+Malaysia+Public+Holiday&md=1&fontSize=100px&images=globe)
### How to Use :sparkles:
Declare
```php
$holiday = new MalaysiaHoliday;
MalaysiaHoliday::make();
app(MalaysiaHoliday::class); // if bound with laravel refer here - https://laravel.com/docs/8.x/container#contextual-binding
```Holidays in current year
```php
$holiday = new MalaysiaHoliday; // MalaysiaHoliday::make()
$holiday->fromAllState()->get();
MalaysiaHoliday::make()->fromAllState()->get();
```Holidays in specific years
```php
$holiday = new MalaysiaHoliday;
$holiday->fromAllState(2017)->get();
$holiday->fromAllState([2017, 2019])->get();
$holiday->fromAllState()->ofYear(2017)->get();
MalaysiaHoliday::make()->fromAllState()->ofYear(2017)->get();
```Holidays by region
```php
$holiday = new MalaysiaHoliday;
$holiday->fromState("Selangor")->get();
$holiday->fromState(["Selangor","Malacca"])->get();
```Holidays by region and year
```php
$holiday = new MalaysiaHoliday;
$holiday->fromState("Selangor","2017")->get();
$holiday->fromState("Selangor", [2017, 2019])->get();
$holiday->fromState(["Selangor","Malacca"], [2017, 2019])->get();
$holiday->fromState(["Selangor","Malacca"])->ofYear([2017, 2019])->get();
```Group and filter results
```php
$holiday = new MalaysiaHoliday;
$holiday->fromAllState()->groupByMonth()->get();
$holiday->fromAllState()->filterByMonth("January")->get(); //date('F')
```### Requirements
PHP 7.0 and above (because 5.6 is too old 😝)### To install
run
`composer require afiqiqmal/malaysiaholiday`
### Sample
{
"status":true,
"data":[
{
"regional":"Selangor",
"collection":[
{
"year":2019,
"data":[
{
"day":"Tuesday",
"date":"2019-01-01",
"date_formatted":"01 January 2019",
"month":"January",
"name":"New Year's Day",
"description":"Regional Holiday",
"is_holiday":true,
"type":"Regional Holiday",
"type_id":4
},
{
"day":"Monday",
"date":"2019-01-21",
"date_formatted":"21 January 2019",
"month":"January",
"name":"Thaipusam",
"description":"Regional Holiday",
"is_holiday":true,
"type":"Regional Holiday",
"type_id":4
}
]
}
]
},
{
"regional":"Johor",
"collection":[
{
"year":2019,
"data":[
{
"day":"Monday",
"date":"2019-01-21",
"date_formatted":"21 January 2019",
"month":"January",
"name":"Thaipusam",
"description":"Regional Holiday",
"is_holiday":true,
"type":"Regional Holiday",
"type_id":4
}
]
}
]
}
],
"developer":{
"name":"Hafiq",
"email":"[email protected]",
"github":"https://github.com/afiqiqmal"
}
}### Source :date:
Scraped from - http://www.officeholidays.com/countries/malaysia
### MIT Licence
Copyright © 2017 @afiqiqmal
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
### Donate to the project :tea: