PHP code example of breadthe / php-simple-calendar

1. Go to this page and download the library: Download breadthe/php-simple-calendar 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/ */

    

breadthe / php-simple-calendar example snippets


use Breadthe\SimpleCalendar\Calendar;

$date = '2020-03-24'; // ISO date

$calendar = new Calendar($date);
$currentMonth = $calendar->grid();

// or use the static constructor
$currentMonth = Calendar::make($date)->grid();

$date = '2020-03-17';
$currentMonth = Calendar::make($date);

$currentMonth->startOfPrevMonth; // get the start of the previous month - instance of Carbon
$currentMonth->startOfPrevMonth->toDateString(); // '2020-02-01'

$currentMonth->startOfNextMonth; // get the start of the previous month - instance of Carbon
$currentMonth->startOfNextMonth->toDateString(); // '2020-04-01'
bash
composer