arokettu/system-clock

The smallest PSR-20 implementation

1.0.0 2023-03-22 01:02 UTC

This package is auto-updated.

Last update: 2023-05-31 00:26:09 UTC


README

Packagist PHP Packagist

The smallest possible PSR-20 implementation for the case when you don't need all the fancy testing clock classes.

Installation

composer require 'arokettu/system-clock'

Example

<?php

$clock = new \Arokettu\SystemClock\SystemClock();
$clockPsrAwareValidator->isValid($clock);

For a specific example, lcobucci/jwt:

<?php

use Arokettu\SystemClock\SystemClock;
use Lcobucci\JWT\Configuration;
use Lcobucci\JWT\Signer\Hmac\Sha256;

$cfg = Configuration::forSymmetricSigner(new Sha256(), '...');
$token = $cfg->parser()->parse('...');

$cfg->validator()->assert(
    $token,
    new StrictValidAt(new SystemClock())
);

Support

Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/php-system-clock/-/issues

License

The library is available as open source under the terms of the MIT No Attribution License.