deligoez / tckimlikno
Laravel的土耳其身份证号码验证与验证包
v5.0.0
2024-06-26 09:37 UTC
Requires
- php: ^8.1 | ^8.2 | ^8.3
- guzzlehttp/guzzle: ^7.2.0
- illuminate/support: ^9.0 | ^10.0 | ^11.0
- ricorocks-digital-agency/soap: ^1.6 | 2.*
Requires (Dev)
- fakerphp/faker: ^1.19
- mockery/mockery: ^1.5
- orchestra/testbench: ^7.5 | ^8.0 | ^9.0
- phpunit/phpunit: ^9.5 | ^10.5
- dev-master
- v5.0.0
- 4.1.0
- 4.0.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.1.0
- 2.0.0
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.1
- 1.1.0
- v1.0.0
- dev-30-birthday-and-birth-month-check-api-now-requires-mandatory-captcha-check
- dev-feature/laravel-8-upgrade
- dev-feature/laravel-7-support
- dev-feature/add-php-7-4-tests-to-travis
- dev-feature/add-type-hints-to-tests
This package is auto-updated.
Last update: 2024-09-26 10:23:51 UTC
README
Laravel的土耳其身份证号码验证与验证包。
安装
通过Composer
$ composer require deligoez/tckimlikno
如果你使用的是Laravel 5.5或更高版本,该包将自动为你注册服务提供者。
用法
use Deligoez\TCKimlikNo\TCKimlikNo; // Verifies Citizenship Number According to it's Algorithm. // Returns Boolean TCKimlikNo::verify('12345678901'); // Returns false TCKimlikNo::verify('10000000146'); // Returns true // Verifies Parameters and validates all using nvi.gov.tr API // Returns Boolean TCKimlikNo::validate('10000000146', 'Yunus Emre', 'Deligöz', '1900') // Auto Uppercase Disabled TCKimlikNo::validate('10000000146', 'YUNUS EMRE', 'DELİGÖZ', '1900', false)
可用的Laravel验证规则
TCKimlikNoVerify
// In a Form Request Class public function rules() { return [ 'tckimlikno' => ['required', new TCKimlikNoVerify()], ]; }
// In a Controller use Deligoez\TCKimlikNo\Rules\TCKimlikNoVerify; /** * Store a tckn. * * @param Request $request * @return Response */ public function store(Request $request) { $validatedData = $request->validate([ 'tckn' => ['bail', 'required', new TCKimlikNoVerify()], ]); // tckn is valid... }
TCKimlikNoValidate
// In a Form Request Class public function rules() { return [ 'tckimlikno' => ['required', new TCKimlikNoValidate( $name, $surname, $birthYear, $autoUppercase // Optional, defaults to true )], ]; }
Faker提供者
use Deligoez\TCKimlikNo\Provider\TCKimlikNoFakerProvider; $faker = Faker\Factory::create(); $faker->addProvider(new TCKimlikNoFakerProvider($faker)); // a Random Valid TCKN $tckn = $faker->tckn; // 60174067810
变更日志
请查看变更日志以获取最近更改的更多信息。
测试
$ composer test
贡献
请查看contributing.md以获取详细信息以及待办事项列表。
安全性
如果你发现任何与安全性相关的问题,请通过电子邮件ye@deligoz.me联系,而不是使用问题跟踪器。
鸣谢
许可协议
MIT。请查看许可文件以获取更多信息。