You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
6 days ago | |
---|---|---|
.gitattributes | 3 months ago | |
.gitignore | 3 months ago | |
CHANGELOG.md | 6 days ago | |
LICENSE.md | 3 months ago | |
README.md | 6 days ago | |
SystemClock.php | 6 days ago | |
composer.json | 6 days ago | |
phpcs.xml | 3 months ago | |
psalm.xml | 3 months ago |
README.md
PSR-20 System Clock Library
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\Clock\SystemClock();
$clockPsrAwareValidator->isValid($clock);
For a specific example, lcobucci/jwt
:
<?php
use Arokettu\Clock\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.