orisai/clock

Provides current time for runtime and controllable time for testing

1.2.1 2024-06-21 08:10 UTC

This package is auto-updated.

Last update: 2024-10-31 17:03:41 UTC


README

Orisai
Clock

Provider of current time for runtime and controllable time for testing

PSR-20 compatible

📄 Check out our documentation.

💸 If you like Orisai, please make a donation. Thank you!

use Orisai\Clock\Clock;
use function Orisai\Clock\now;

class ExampleService
{

	private Clock $clock;

	public function __construct(Clock $clock)
	{
		$this->clock = $clock;
	}

	public function doSomething(): void
	{
		$currentTime = $this->clock->now();
		// Or
		$currentTime = now();
	}

}