php-extended/php-checksum-object

一个实现 php-extended/php-checksum-interface 的库

7.0.6 2024-07-31 13:57 UTC

This package is auto-updated.

Last update: 2024-08-31 12:07:08 UTC


README

一个实现 php-extended/php-checksum-interface 对象算法的库。

coverage build status

安装

此库通过 composer 安装,并使用其自加载器自动加载此库的所有类。

  • 他们的网站下载 composer.phar
  • 然后运行以下命令以将此库作为依赖项安装:
  • php composer.phar require php-extended/php-checksum-object ^7

基本用法

您可以按照以下方式使用此库


use PhpExtended\Checksum\Checksumobject;

$checksum = new ChecksumLuhn();

$data = '<put your digit string here>';
$checked = $checksum->matches(substr($data, 0, -1), substr($data, -1));
// returns true if verified

$signed = $data.$checksum->calculate($data);
// appends the calculated digit to the checksum

许可证

MIT (见许可证文件)。