jaroslavlibal/datetime

DateTime helpers

Installs: 27

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/jaroslavlibal/datetime

0.1 2017-07-08 15:48 UTC

This package is not auto-updated.

Last update: 2025-09-28 08:19:52 UTC


README

Installation

Install package jaroslavlibal/datetime with Composer and register the parts you need as the services.

composer require jaroslavlibal/datetime

Factory

Retrieve the DateTime and DateTimeImmutable objects from the mockable and testable factory instead of direct new \DateTime() creation.

Usage

class Foo
{

   use JaroslavLibal\DateTime\Factory\DateTimeFactory;  
   use JaroslavLibal\DateTime\Factory\DateTimeFactory;  

   private DateTimeFactory;
   private DateTimeImmutableFactory;

   public function __construct(DateTimeFactory $dateTimeFactory, DateTimeImmutableFactory $dateTimeImmutableFactory)

   private function bar() {
      $dateTimeFactory->create();
      $dateTimeImmutableFactory->create();
   }
}