Skip to content

This code helps you to check dates against holidays and worktime.

License

Notifications You must be signed in to change notification settings

DIOHz0r/holidays

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Holidays

This library helps you to add and check dates against holidays and worktime.

Install

Is recommended to install this via composer:

$ composer require diohz0r/holidays

Use

The use is very simple, extend the class add your regional holidays and create the object. Example:

    <?php
	use Holidays\AbstractHoliday;

	class Holiday extends AbstractHoliday {
	
	    /**
	     * @inheritdoc
	     */
	    public function addRegionalHolidays($year)
	    {
            //Fixed Days
            $dates = array(
                array('day'=>4,'month'=>6),
                array('day'=>12,'month'=>10),
            );
            foreach ($dates as $date) {
                $this->addHoliday($date);
            }
            //Variable day
            $this->addVariableHoliday(4, 11, $year, 4); #Thanksgiving: November's 4th Thursday
            
            //In Venezuela Carnival and Easter are holidays so we call this method to add both
            $this->getCarnival();
	    }
	}

	$objHoliday = new Holiday(date("Y"));
	if($objHoliday->isValidDate("2014-06-04")){
		//Add your logic for valid dates
	} else {
		//Add your logic for invalid dates
	}

About

This code helps you to check dates against holidays and worktime.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages