PHP code example of offchaindata / holiday-oracle-php

1. Go to this page and download the library: Download offchaindata/holiday-oracle-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

offchaindata / holiday-oracle-php example snippets


public function holidays($country, $year, array $options = [])



fChainData\HolidayOracle\Client;
$client = new Client('INSERT API TOKEN');

try {
    $response = $client->locations();
    ...
} catch (\Exception $e) {
    echo $e->getMessage();
}

try {
    $response = $client->date('2020-01-01', 'AU', ['subdivision' => 'NSW']);
    ...
} catch (\Exception $e) {
    echo $e->getMessage();
}

try {
    $response = $client->holidays('AU', '2020');
    ...
} catch (\Exception $e) {
    echo $e->getMessage();
}

try {
    $response = $client->businessDays('2020-01-01', '2020-02-01', 'AU');
    ...
} catch (\Exception $e) {
    echo $e->getMessage();
}

try {
    $response = $client->businessDays('2020-01-01', '2020-02-01', 'AU');
    ...
} catch (\Exception $e) {
    var_dump($client->getLastResponseStatus());
}
composer