2017 © Pedro Peláez
 

library date-time-immutable

Polyfill for the DateTimeImmutable class added in PHP 5.5.0

image

comsolit/date-time-immutable

Polyfill for the DateTimeImmutable class added in PHP 5.5.0

  • Thursday, March 19, 2015
  • by comsolit
  • Repository
  • 9 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

DateTimeImmutable polyfill

Build Status, (*1)

This small library adds a polyfill for the DateTimeImmutable object introduced in PHP 5.5.0., (*2)

Authors

  • Chris Wilkinson

It's partially based on Benjamin Eberlei's Immutable DateTime Objects blog post., (*3)

Installation

$ php composer.phar require thewilkybarkid/date-time-immutable:~1.0

Basic usage

$dateTime = new DateTimeImmutable();
$newDateTime = $datetime->modify('+1 day');
var_dump($dateTime === $newDateTime); // output 'bool(false)'

Caveats

PHP 5.5.0 also introduced a DateTimeInterface which both DateTimeImmutable and DateTime implement. In this polyfill we can't change the DateTime class, so DateTimeImmutable has to extend it. This is slightly dangerous as their behaviour is not compatible (see https://bugs.php.net/bug.php?id=64513)., (*4)

PHP 5.6.0 added a DateTimeImmutable::createFromMutable() factory method, which this polyfill doesn't include., (*5)

The Versions

19/03 2015

dev-master

9999999-dev https://github.com/comsolit/date-time-immutable

Polyfill for the DateTimeImmutable class added in PHP 5.5.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar comsolit
by Avatar thewilkybarkid

19/03 2015

v2.0.0+alpha1

2.0.0.0 https://github.com/comsolit/date-time-immutable

Polyfill for the DateTimeImmutable class added in PHP 5.5.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar comsolit
by Avatar thewilkybarkid

23/10 2014

v1.0.2

1.0.2.0 https://github.com/thewilkybarkid/date-time-immutable

Polyfill for the DateTimeImmutable class added in PHP 5.5.0

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

The Development Requires

by Avatar thewilkybarkid

21/10 2014

v1.0.1

1.0.1.0 https://github.com/thewilkybarkid/date-time-immutable

Polyfill for the DateTimeImmutable class added in PHP 5.5.0

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

The Development Requires

by Avatar thewilkybarkid

11/11 2013

v1.0.0

1.0.0.0 https://github.com/thewilkybarkid/date-time-immutable

Polyfill for the DateTimeImmutable class added in PHP 5.5.0

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

The Development Requires

by Avatar thewilkybarkid