2017 © Pedro Peláez
 

project calendar-month

image

dzava/calendar-month

  • Thursday, April 5, 2018
  • by dzava
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Usage

Creating a Month instance

use Dzava\CalendarMonth\Month;

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

Retrieving the days in a month

To get an array of the days in a month use the days() method., (*1)

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
// }

To get a list of days per week of the month use the weeks() method., (*2)

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
// }

By default the weeks start on Sunday. If you want your weeks to start on a different day, use the weekStartsAt($day) method. 0 (for Sunday) through 6 (for Saturday)., (*3)

Checks

To check if a given date belongs to the month use the contains($day) method. The day can be either a Carbon instance or in any other format that is supported by the Carbon constructor., (*4)

use Dzava\CalendarMonth\Month;

$month = new Month(5, 2018);

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

The Versions

05/04 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dimitris Zavantias

05/04 2018

v1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dimitris Zavantias

02/04 2018

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dimitris Zavantias