tarfin-labs / tax-identification-number
API client for validating Tax Identification Number.
Installs: 9 609
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ^7.4|^8.0|^8.1|^8.2
- ext-json: *
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2024-12-11 18:05:13 UTC
README
Introduction
With this package you can get tax offices by city plates and validate tax identification numbers on GIB (Gelir İdaresi Başkanlığı).
This package requires PHP
7.4
or higher.
Installation
You can install the package via composer:
composer require tarfin-labs/tax-identification-number
Usage
Listing tax offices by city plate:
use TarfinLabs\TaxIdentificationNumber\Validation; use TarfinLabs\TaxIdentificationNumber\Exceptions\NotFoundException; try { $offices = Validation::init()->getTaxOfficesByCityPlate(34); } catch (NotFoundException $e) { echo $e->getMessage(); }
Output:
[
[
"code" => "034XXX",
"name" => "TAX OFFICE NAME 1",
],
[
"code" => "034XXY",
"name" => "TAX OFFICE NAME 2
],
]
Validating a tax identification number:
use TarfinLabs\TaxIdentificationNumber\Validation; try { $response = Validation::init()->validate(1234567890, '034455'); $response->isValid(); // boolean $response->getStatus(); // "1" $response->getTckn(); // "" $response->getStatusText(); // "FAAL" $response->getTaxNumber(); // "123123123" $response->getTaxOfficeNumber(); // "034455" $response->getCompanyTitle(); // "ACME INC." } catch (\Throwable $e) { echo $e->getMessage(); }
If you want to validate a TCKN for a sole proprietorship, you need to give TCKN (11 characters) as first parameter to validate()
method.
use TarfinLabs\TaxIdentificationNumber\Validation; try { $response = Validation::init()->validate(12345678902, '034455'); $response->isValid(); // boolean $response->getStatus(); // "1" $response->getTckn(); // "12345678902" $response->getStatusText(); // "FAAL" $response->getTaxNumber(); // "9999999999" $response->getTaxOfficeNumber(); // "034455" $response->getCompanyTitle(); // "METİN KAYA" } catch (\Throwable $e) { echo $e->getMessage(); }
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email development@tarfin.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.