epigra/tckimlik
A PHP package for validating and generating Turkish TC Kimlik (national ID) numbers, with Laravel validation rule support and a simple API for checking ID format and checksum, making Turkish identity verification easy to add to forms and applications.
Install via Composer (composer require epigra/tckimlik). The package is a single-purpose utility for Turkish Identification Numbers (TCKN). Start by reading the README and src/TcKimlik.php; there is no config file or migrations. The first use case is algorithmic validation:
use Epigra\TcKimlik;
TcKimlik::validate('10000000146'); // bool
TcKimlik::generate(); // returns a checksum-valid TCKN
No service provider registration is required unless you want the facade alias. In Laravel, you can call the class statically or inject it if you bind it in a service provider.
TcKimlik::validate() in a Rule object or closure for form requests:
'tcno' => ['required', 'string', 'size:11', function ($attr, $value, $fail) {
if (! TcKimlik::validate($value)) {
$fail('Geçersiz TC Kimlik No.');
}
}],
setTcnoAttribute mutator that rejects invalid values.TcKimlik::generate() in factories and seeders when you need realistic-looking but checksum-valid numbers. Do not use generated numbers as real identities.TcKimlikRule class in app/Rules and reuse it across registration, profile, and checkout forms.validate().Transliterator in trUpper. This method now relies on PHP’s intl extension to correctly uppercase Turkish characters (i → İ). Ensure ext-intl is installed in all environments (local, CI, production). If trUpper throws or behaves unexpectedly after upgrading, check php -m | grep intl.Epigra\TcKimlik in config/app.php aliases or use the fully qualified class name.How can I help you explore Laravel packages today?