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