This project is not covered by Drupal’s security advisory policy.
Provides a field type for the Turkish tax identification number (Vergi Kimlik Numarası, VKN) and validates the 10-digit number with its check digit algorithm, so mistyped numbers are rejected on save.
In Türkiye, every company and legal entity is identified by a 10-digit VKN. The last digit is a check digit calculated from the first nine. This module adds a dedicated field type that knows this rule, so site builders do not have to write custom validation code or regular expressions.
Features
- A "TC VKN" field type that can be added to any fieldable entity: content types, users, taxonomy terms, media and custom entities.
- Validation of length (exactly 10 digits) and of the check digit.
- Validation is implemented as a constraint on the field, so it applies everywhere an entity is validated: entity forms, JSON:API, REST and imports that run entity validation.
- The value is stored as a string, so numbers with leading zeros are preserved.
- A validator service for checking a VKN anywhere in custom code.
- Validation runs entirely offline. No request is sent to any external service.
Typical use cases: company or supplier records, invoicing data, membership and application forms, and any content type that must hold the tax number of a Turkish legal entity.
Please note that the module checks whether a number is well formed. It does not check whether the number belongs to a registered taxpayer. That can only be confirmed through the services of the Turkish Revenue Administration (GİB).
Post-Installation
There is no configuration page. After enabling the module:
- Go to Structure > Content types > (your type) > Manage fields, or the "Manage fields" tab of any other entity type.
- Click "Add field" and pick the "TC VKN" field type.
- Save. The field now rejects any value that is not a valid VKN.
To validate a number in custom code:
if (\Drupal::service('tcvkn_field.validator')->validate($vkn)) {
// Valid.
}
Additional Requirements
Drupal 11. Nothing beyond Drupal core is required.
Recommended modules/libraries
T.C. Kimlik Kontrol (tckk_field) provides the equivalent field for the 11-digit Turkish identification number of natural persons. The two modules complement each other on sites that store records of both persons and companies.
Similar projects
- T.C. Kimlik Kontrol validates the T.C. Kimlik No, which uses a different length and a different algorithm. It does not handle the VKN.
- Field Validation can restrict a text field to 10 digits with a regular expression, but a regular expression cannot verify the check digit.
Project information
- Project categories: Integrations
- Created by orkutmuratyilmaz on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.

