2017 © Pedro PelĂĄez
 

library hammertime

Some extensions to Carbon (a DateTime class)

image

cherrypick/hammertime

Some extensions to Carbon (a DateTime class)

  • Wednesday, March 21, 2018
  • by digilist
  • Repository
  • 2 Watchers
  • 3 Stars
  • 4,924 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 11 % Grown

The README.md

Alright stop 
 HammerTime!

MC Hammer having a Hammer time, (*1)

This date library extends Carbon with some more sophisticated date calculations and getters / setters for all date parts., (*2)

Installation

Install using composer:, (*3)

composer require cherrypick/hammertime

Features

More sophisticated date calculations

The date calculations with HammerTime are closer to real world problems. When you are at the end of a month and add another month, it doesn't leap into the beginning of the month afterwards., (*4)

$date = HammerTime::createFromDate(2014, 5, 31);
$date->addMonths(1); // 2014-06-30 (with default PHP DateTime (and Carbon) it would be 2014-07-01)

$date = HammerTime::createFromDate(2012, 2, 29);
$date->addYear(1); // 2013-02-28 (with default PHP DateTime (and Carbon) it would be 2013-03-01)

Similar, it applies to the diff of months. You can find more information and examples here., (*5)

$date1 = HammerTime::createFromDate(2014, 2, 1);
$date2 = HammerTime::createFromDate(2014, 3, 1);

$date1->diffInMonths($date2); // 1 (with default PHP DateTime (and Carbon) it would be 0)

Date Comparisons

This library provides some more clear names for date comparisons., (*6)

$date1->isSameDate($date2);
$date1->isBefore($date2);
$date1->isBeforeOrEqual($date2);
$date1->isAfter($date2);
$date1->isAfterOrEqual($date2);

Getters and Setters

This library provides getters and setters for all available date information:, (*7)

$date = HammerTime::createFromDate(2014, 11, 30, 12, 42, 42);
$date->getDay(); // 30
$date->getMonth(); // 11
$date->getYear(); // 2014
$date->getHour(); // 12
$date->getMinute(); // 42
$date->getSecond(); // 42
// and many more...

// the same applies to setters.
$date->setDay(20); // 2014-11-20
// etc..

There are Getters and Setters for every availble property., (*8)

The Versions

21/03 2018

dev-master

9999999-dev

Some extensions to Carbon (a DateTime class)

  Sources   Download

MIT

The Requires

 

by Markus Fasselt
by Konstantin Möllers

21/03 2018

v0.4

0.4.0.0

Some extensions to Carbon (a DateTime class)

  Sources   Download

MIT

The Requires

 

by Markus Fasselt
by Konstantin Möllers

21/03 2018

v0.3.1

0.3.1.0

Some extensions to Carbon (a DateTime class)

  Sources   Download

MIT

The Requires

 

by Markus Fasselt
by Konstantin Möllers

05/01 2018

dev-chronos

dev-chronos

Some extensions to Carbon (a DateTime class)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Markus Fasselt
by Konstantin Möllers

30/04 2015

v0.3

0.3.0.0

Some extensions to Carbon (a DateTime class)

  Sources   Download

MIT

The Requires

 

by Markus Fasselt
by Konstantin Möllers

30/04 2015

v0.2

0.2.0.0

Some extensions to Carbon (a DateTime class)

  Sources   Download

MIT

The Requires

 

by Markus Fasselt
by Konstantin Möllers

17/12 2014

v0.1

0.1.0.0

Some extensions to Carbon (a DateTime class)

  Sources   Download

MIT

The Requires

 

by Markus Fasselt
by Konstantin Möllers