Download the PHP package laravingo/turkiye-validator without Composer

On this page you can find all versions of the php package laravingo/turkiye-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package turkiye-validator

Turkiye Validator

🇺🇸 English | 🇹🇷 Türkçe | 🇪🇸 Español

Latest Version on Packagist GitHub Tests Action Status Total Downloads License

PHP Version Laravel Version License

The ultimate Swiss Army Knife for Turkish data validation, sanitization, and testing in Laravel.

This package provides a comprehensive suite of validation rules (Official Algorithms), sanitization utilities, Eloquent casts, and Faker providers specifically tailored for Turkish data requirements (Identity Numbers, VKN, License Plates, IBAN, KEP, etc.).


Installation

You can install the package via composer:

Publishing Assets

To customize the configuration or error messages, publish the assets:


Configuration

After publishing, you can configure the package in config/turkiye-validator.php:


Validation Rules

This package strictly implements official mathematical algorithms (checksums, modulo checks) rather than simple regex matching.

Available Rules

Rule Name Description Example Input
turkish_id Validates T.C. Identity Number (11 digits, Algo Check). 10000000146
turkish_phone Validates Turkish Mobile Numbers. 555 123 45 67 or 0555...
tax_id Validates Tax ID (Vergi Kimlik No, 10 digits, Mod-10). 1234567890
license_plate Validates Turkish License Plates (City Code 01-81). 34 ABC 123
turkish_iban Validates Turkish IBANs (TR prefix + Mod-97 checksum). TR12000...
tr_id_card_serial Validates New Identity Card Serial Numbers. A12F34567
kep_address Validates Registered Electronic Mail (KEP) addresses. [email protected]
city_code Validates Turkish City Plate Codes (1-81). 34, 6, 81

Usage Example

In your Controller or Form Request:


Address & Data Service

The package includes a data service to easily access official lists of Turkish cities and districts.

Usage


Helper Functions

Utility helpers are available via the Turkiye facade to format and mask sensitive data.

Phone Formatting

Identity Masking


Sanitization & Helper

The package provides a TurkishSanitizer class (and a Turkiye facade) to clean messy input. It explicitly handles Turkish character conversion (i/İ/I/ı) correctly, regardless of server locale.

Usage


Eloquent Casts (Pro Feature)

Automatically clean and format your data before it is saved to the database using Laravel Custom Casts.

Usage in Model

Now, when you do $user->phone = '(555) 123'; $user->save();, it saves 555123... to the DB.


Faker Provider (Testing)

We automatically register a Faker provider so you can generate mathematically valid test data in your factories and seeds.

Usage


Localization

The package supports English (en) and Turkish (tr) out of the box.

To change the language, simply set your Laravel app locale in config/app.php:

The error messages will automatically switch to Turkish (e.g., "Geçerli bir T.C. Kimlik Numarası olmalıdır").


License

The MIT License (MIT). Please see License File for more information.


Testing

This package uses Pest PHP for automated testing.

To run specific tests:


All versions of turkiye-validator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package laravingo/turkiye-validator contains the following files

Loading the files please wait ...