ybelenko / ogrn
俄罗斯OGRN和OGRNIP商业标识符验证的微型库。
v2.0.0
2022-03-21 21:07 UTC
Requires
- php: ^7.0 || ^8.0
- ext-gmp: *
Requires (Dev)
- phpmd/phpmd: ^2.11
- phpunit/phpunit: ^8.0 || ^9.0
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-09-22 02:33:57 UTC
README
俄罗斯OGRN(ОГРН)和OGRNIP(ОГРНИП)商业标识符验证的微型PHP库。它只验证数字长度和最后一位校验码,因此如果标识符通过验证,并不意味着它在现实生活中存在。如果您需要检查OGRN或OGRNIP是否存在,请访问 http://egrul.nalog.ru。
安装
建议使用 Composer 进行安装。
$ composer require ybelenko/ogrn
使用方法
require_once __DIR__ . '/vendor/autoload.php'; use Ybelenko\Ogrn\Ogrn; use Ybelenko\Ogrn\Ogrnip; // when you need to validate OGRN number $isValid = Ogrn::validate("1127746509780");// returns true if identifier is valid // when you need to validate OGRNIP number $isValid = Ogrnip::validate("304500116000157");// returns true if identifier is valid
虽然32位系统的最大有符号整数范围为-2147483648到2147483647,但您始终应将OGRN和OGRNIP标识符存储为字符串。
$ogrn = 1127746509780; // is bad echo $ogrn; // 2147483647 $ogrn = '1127746509780'; // is good echo $ogrn; // 1127746509780
测试
要执行测试套件,您需要克隆当前仓库并安装其开发依赖项。
$ git clone https://github.com/ybelenko/ogrn $ cd ogrn $ composer install $ composer test