CodeIgniter third-party library deals with Holiday API based an official PHP library
CodeIgniter third-party library deals with Holiday API based on official PHP library .
Note that following steps assume that you have correctly installed Composer and configured CodeIgniter on your server.
Please use Composer to install it and include it as a third-party package in your CodeIgniter application.
composer require joel-depiltech/codeigniter-holidayapi
$config['composer_autoload'] = TRUE; // or a custom path as 'vendor/autoload.php'
$this->load->add_package_path(APPPATH . 'third_party/holidayapi');
$this->load->library('HolidayAPI');
$config['holidayapi_test_api_key'] = '058f4506-caf0-4bdd-b52b-cbc98e20e02e';
$config['holidayapi_live_api_key'] = '*** Fill in your own Live API key ***';
By default, fetch all holidays of this year for USA :
<?php
$this->load->library('HolidayAPI');
$holidays = $this->holidayapi->holidays();
print_r($holidays);
A example to fetch all upcoming holidays for France from Christmas to end of 2018 with a specific API key :
<?php
$this->load->library('HolidayAPI', array('holidayapi_live_api_key' => '** An other API key **'));
$holidays = $this->holidayapi->holidays('FR', 2018, 12, 25, FALSE, TRUE);
print_r($holidays);