PHP code example of artarts36 / laravel-holiday

1. Go to this page and download the library: Download artarts36/laravel-holiday 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/ */

    

artarts36 / laravel-holiday example snippets


$client = new \GuzzleHttp\Client([
    'base_uri' => 'https://isdayoff.ru/',
]);

$isDayOff = new \ArtARTs36\LaravelHoliday\Determiners\IsDayOff($client);

var_dump($isDayOff->determine(\Carbon\Carbon::parse('2020-11-04'))); // string(7) "weekend"

$client = new \GuzzleHttp\Client([
    'base_uri' => 'https://isdayoff.ru/',
]);

$isDayOff = new \ArtARTs36\LaravelHoliday\Determiners\IsDayOff($client);

var_dump($isDayOff->determinePeriod(\Carbon\Carbon::parse('2020-11-04'), \Carbon\Carbon::parse('2020-12-15')));

$client = new \GuzzleHttp\Client([
    'base_uri' => 'https://isdayoff.ru/',
]);

$isDayOff = new \ArtARTs36\LaravelHoliday\Determiners\IsDayOff($client);

var_dump($isDayOff->determineYear(20));

$fetch = app(\ArtARTs36\LaravelHoliday\Services\Fetch::class);

$fetch->fetch('2019');

$fetch = app(\ArtARTs36\LaravelHoliday\Services\Fetch::class);

$fetch->fetch(\ArtARTs36\LaravelHoliday\Services\Fetch::TYPE_CURRENT_YEAR);

$fetch = app(\ArtARTs36\LaravelHoliday\Services\Fetch::class);

$fetch->fetch(\ArtARTs36\LaravelHoliday\Services\Fetch::TYPE_CURRENT_MONTH);

$fetch = app(\ArtARTs36\LaravelHoliday\Services\Fetch::class);

$fetch->fetch(\ArtARTs36\LaravelHoliday\Services\Fetch::TYPE_NEXT_WEEK);