Skip to content
/ clock Public

Provides current time for runtime and controllable time for testing

License

Notifications You must be signed in to change notification settings

orisai/clock

Repository files navigation

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();
	}

}