PHP code example of koriym / now

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

    

koriym / now example snippets


use namespace Koriym\Now\Now;
use namespace Koriym\Now\FakeNow;

$now = new Now;
(string) $now // 2015-11-09 01:00:00

$fakeNow = new FakeNow;
(string) $fakeNow // 1970-01-01 00:00:00 = FakeNow::Time

use namespace Koriym\Now\NowInterface;

public function configure()
{
    // prod
    $this->bind(NowInterface::class)->to(Now::class);
    // develop
    $this->bind(NowInterface::class)->to(FakeNow::class);
}