Skip to content

Commit

Permalink
Merge pull request #6 from afiqiqmal/dev
Browse files Browse the repository at this point in the history
Update Library
  • Loading branch information
afiqiqmal authored Oct 4, 2020
2 parents 9bc3515 + 282fd5e commit e643684
Show file tree
Hide file tree
Showing 6 changed files with 838 additions and 232 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: php
php:
- '7.2'
- '7.3'
- '7.4
before_script:
- composer install --ignore-platform-reqs
Expand Down
40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,54 @@ Parsing Malaysia Public Holiday.
[![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)


### Usage

Holidays in current years

```php
$holiday = new Holiday;
$holiday->getAllRegionHoliday()->get();
$holiday = new MalaysiaHoliday; // MalaysiaHoliday::make()
$holiday->fromAllState()->get();
MalaysiaHoliday::make()->fromAllState()->get();
```

Holidays in specific years

```php
$holiday = new Holiday;
$holiday->getAllRegionHoliday(2017)->get();
$holiday->getAllRegionHoliday([2017, 2019])->get();
$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 regional

```php
$holiday = new Holiday;
$holiday->getRegionHoliday("Selangor")->get();
$holiday->getRegionHoliday(["Selangor","Malacca"])->get();
$holiday = new MalaysiaHoliday;
$holiday->fromState("Selangor")->get();
$holiday->fromState(["Selangor","Malacca"])->get();
```

Holidays by regional in 2017

```php
$holiday = new Holiday;
$holiday->getRegionHoliday("Selangor","2017")->get();
$holiday->getRegionHoliday("Selangor", [2017, 2019])->get();
$holiday->getRegionHoliday(["Selangor","Malacca"], [2017, 2019])->get();
$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();
```


Grouping and Filter result

```php
$holiday = new Holiday;
$holiday->getAllRegionHoliday()->groupByMonth()->get();
$holiday->getAllRegionHoliday()->filterByMonth("January")->get(); //date('F')
$holiday = new MalaysiaHoliday;
$holiday->fromAllState()->groupByMonth()->get();
$holiday->fromAllState()->filterByMonth("January")->get(); //date('F')
```

### Requirement
Expand Down Expand Up @@ -151,3 +156,8 @@ 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.



<a href="https://www.paypal.com/paypalme/mhi9388?locale.x=en_US"><img src="https://i.imgur.com/Y2gqr2j.png" height="40"></a>

Loading

0 comments on commit e643684

Please sign in to comment.