arokettu / system-clock
The smallest PSR-20 implementation (PHP 7.0 and later)
2.0.2
2024-07-20 01:39 UTC
Requires
- php: ^7.0 | ^8.0
- psr/clock: ^1.0
Requires (Dev)
- psy/psysh: ^0.12.4
- sandfox.dev/code-standard: ^1.2024.07.05
- squizlabs/php_codesniffer: *
- vimeo/psalm: ^4 | ^5
Provides
Conflicts
- arokettu/clock: < 1.2 | >=2.0 <2.2
README
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()) );
Read full documentation here: https://sandfox.dev/php/clock/system-clock.html
Also on Read the Docs: https://arokettu-clock.readthedocs.io/en/latest/system-clock.html
Support
Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/php-system-clock/-/issues
Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community
License
The library is available as open source under the terms of the MIT No Attribution License.