PHP code example of colybri / business-day

1. Go to this page and download the library: Download colybri/business-day 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/ */

    

colybri / business-day example snippets


Colybri\BusinessDay\BusinessDayServiceProvider::class,

'BusinessDay' => Colybri\BusinessDay\BusinessDay::class,

use Colybri\BusinessDay\BusinessDay;

$date = BusinessDay::now();

return [
 /*
  |--------------------------------------------------------------------------
  | Holidays calendar
  |--------------------------------------------------------------------------
  |
  */
  'restDay' => 0, //Sunday
  'saturdayIsBusinessDay' => "false",
  'holidays' => [
      "01-01",
      $date->easterSunday()->addDay()->config(),
      $date->goodFriday()->config(),
      "06-01",
      //vacational periods
      [
          "01-08", "31-08"
      ],
      [
          "24-12", "27-12"
      ],
      ...
  ],
];

use Colybri\BusinessDay\BusinessDay;

$date = BusinessDay::now();
$date->isBusinessDay(); //return true or false
$date->nextBusinessDay();
$date->previousBusinessDay();

$date = new BusinessDay('2000-01-31', 'Europe/Brussels');
$date->ashWednesday();
$date->palmSunday();
$date->maundyThursday();
$date->goodFriday();
$date->easterSunday();
$date->easterMonday();
$date->ascensionDay();
$date->pentecostSunday();
$date->pentecostMonday();

php artisan vendor:publish --provider="Colybri\BusinessDay\BusinessDayServiceProvider"