deligoez / tckimlikno
Turkish Identification Number Verification & Validation Package for Laravel
Installs: 14 225
Dependents: 1
Suggesters: 0
Security: 0
Stars: 28
Watchers: 4
Forks: 9
Open Issues: 1
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-10-26 10:32:37 UTC
README
Turkish Identification Number Verification & Validation Package for Laravel.
Installation
Via Composer
$ composer require deligoez/tckimlikno
If you are using Laravel 5.5+, the package will automatically register the service provider for you.
Usage
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)
Available Laravel Validation Rules
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 Provider
use Deligoez\TCKimlikNo\Provider\TCKimlikNoFakerProvider; $faker = Faker\Factory::create(); $faker->addProvider(new TCKimlikNoFakerProvider($faker)); // a Random Valid TCKN $tckn = $faker->tckn; // 60174067810
Changelog
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see contributing.md for details and a todo list.
Security
If you discover any security related issues, please email ye@deligoz.me instead of using the issue tracker.
Credits
License
MIT. Please see the license file for more information.