PHP code example of dzava / calendar-month

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

    

dzava / calendar-month example snippets


use Dzava\CalendarMonth\Month;

new Month(); // current month
new Month(5); // may of current year
new Month(5, 2019); // may of 2019

use Dzava\CalendarMonth\Month;

$month = new Month(5, 2018);

$days = $month->days();

// array(31) {
//    [0] => class Carbon\Carbon {} // 2018-05-01
//    ...
//    [30] => class Carbon\Carbon {} // 2018-05-31
// }

use Dzava\CalendarMonth\Month;

$month = new Month(5, 2018);

$weeks = $month->weeks();

// array(5) {
//    [0] => array(7) {
//        [0] => class Carbon\Carbon {} // 2018-04-29
//        ...
//        [6] => class Carbon\Carbon {} // 2018-05-05
//    }
//    ...
//    [4] => array(7) {} // 2018-05-27 - 2018-06-02
// }

use Dzava\CalendarMonth\Month;

$month = new Month(5, 2018);

$month->contains('2018-05-02'); // true
$month->contains('2018-04-02'); // false