A UI & DB agnostic PHP package for code generation and verification. It only aims on providing an API for generating cryptographic codes and verifying between two given codes elegantly.
Requires PHP 8.3+
You can install the package via composer:
composer require codelabmw/testament
<?php
$testament = new \Codelabmw\Testament\Testament::default();
$code = $testament->generate(
type: \Codelabmw\Testament\Enums\CodeType::NUMERIC /* code type - numeric | alpa | alphanumeric | password */,
length: 8 /* number of characters */
);
$codeFromUser = getUserCode();
$codeFromStorage = getStorageCode();
$verified = $testament->verify(
expected: $codeFromUser /* ... */,
actual: $codeFromStorage /* ... */,
);
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.