These libraries are maintained by the developers at Calendarific as well as freelance developers and are the easiest way to integrate our API with your application.

We’re building a wishlist of Calendarific plugins, libraries, and integrations. If you have something you’d like to see, or would like to contribute, let us know!

If you have any specific questions around the examples, your best bet is to either email us directly or just open a pull request or an issue on GitHub or StackOverflow.

Javascript/NodeJS


The Calendarific Node.js library is available as an npm package. You can install the package by using the npm command listed here.

npm install --save node-calendarific

or just

npm install node-calendarific

Below is an example of how to use the module

// Load the package
const Calendarific = require('node-calendarific');

// Initlize with an API key
const clapi = new Calendarific('_YOUR_API_KEY_');

const parameters = {
country: 'US',
year:    2019,
};

clapi.holidays(parameters, function (data) {
console.log(data)
// Insert awesome code here...
});

PHP


The Calendarific PHP library is available as a Composer package on Packagist.org.

Installation

composer require "calendarific/calendarific"

Usage

$ciapi = new Calendarific\v1('_YOUR_API_KEY_');

$parameters = array(
'country' => 'US',
'year' => 2019
);

$response = $ciapi->holidays($parameters);

Python


The Calendarific Python library is available as a PIP package.

Installation

pip install python-calendarific

Usage

import calendarific

calapi = calendarific.v2('_REPLACE_WITH_API_KEY_')

parameters = {
# Required
'country': 'US',
'year':    2019,
}

holidays = calapi.holidays(parameters)

Ruby


The Calendarific Ruby library is available as a Ruby gem.

Installation

gem install ruby-calendarific

Usage

require 'ruby-calendarific'

capi = Calendarific::V2.new('_YOUR_API_KEY_HERE_')

parameters = {
'country' => 'US',
'year'    => 2019
}

response = capi.holidays(parameters)

Golang


The Calendarific Golang library is available as a Golang package. To install the package, use this command below:

dep ensure -add github.com/calendarific/go-calendarific

To use this library, create a file called main.go & insert a script like below

package main

import (
"fmt"
"github.com/calendarific/go-calendarific"
"os"
)

func main() {

// Loading the paramater struct
cp := calendarific.CalParameters{
 ApiKey:  "",
 Country: "US",
 Year:    2019,
}

// It returns a response struct
holidays, err := cp.CalData()
if err != nil {
 fmt.Println(err)
 os.Exit(1)
}

fmt.Println(holidays)
}

Dart


The Calendarific Dart library is available as a Dart package. You will find usage directions below:

This library was contributed by Markus Krebs. View the source code here: https://github.com/jayjah/calendarific_dart

{literal}
import 'package:calendarific_dart/calendarific_dart.dart';

Future main() async {
const String apiKey = '';
final CalendarificApi api = CalendarificApi(apiKey);
print('Countries: ${await api.getCountries()}');
print('Languages: ${await api.getLanguages()}');
print('Holidays: ${await api.getHolidays(countryCode: 'DE', year: '2022')}');
}
{/literal}