{"id":23145920,"url":"https://github.com/seisigmasrl/dgii-rnc-validator","last_synced_at":"2026-02-01T20:10:18.957Z","repository":{"id":65393962,"uuid":"591135218","full_name":"seisigmasrl/dgii-rnc-validator","owner":"seisigmasrl","description":"A simple package to check a given RNC with the official Tax Authority, Dirección General de Impuestos Internos (DGII), in the Dominican Republic.","archived":false,"fork":false,"pushed_at":"2025-10-13T13:24:58.000Z","size":84,"stargazers_count":7,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-28T23:42:31.827Z","etag":null,"topics":["php","rnc","validator"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seisigmasrl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"ricardov03"}},"created_at":"2023-01-20T01:49:09.000Z","updated_at":"2025-08-11T19:54:08.000Z","dependencies_parsed_at":"2025-05-12T14:44:38.332Z","dependency_job_id":"7ef953d9-fc69-4f19-b580-54295a2f88b0","html_url":"https://github.com/seisigmasrl/dgii-rnc-validator","commit_stats":{"total_commits":44,"total_committers":4,"mean_commits":11.0,"dds":0.5454545454545454,"last_synced_commit":"e1ba8b4da5a9ea83496818b08603539a5436c5ce"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":"spatie/package-skeleton-php","purl":"pkg:github/seisigmasrl/dgii-rnc-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seisigmasrl%2Fdgii-rnc-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seisigmasrl%2Fdgii-rnc-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seisigmasrl%2Fdgii-rnc-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seisigmasrl%2Fdgii-rnc-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seisigmasrl","download_url":"https://codeload.github.com/seisigmasrl/dgii-rnc-validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seisigmasrl%2Fdgii-rnc-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28988633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T18:17:03.387Z","status":"ssl_error","status_checked_at":"2026-02-01T18:16:57.287Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","rnc","validator"],"created_at":"2024-12-17T16:18:56.779Z","updated_at":"2026-02-01T20:10:18.945Z","avatar_url":"https://github.com/seisigmasrl.png","language":"PHP","funding_links":["https://github.com/sponsors/ricardov03"],"categories":[],"sub_categories":[],"readme":"# Validate any RNC with the DGII\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/seisigmasrl/dgii-rnc-validator.svg?style=flat-square)](https://packagist.org/packages/seisigmasrl/dgii-rnc-validator)\n[![Tests](https://img.shields.io/github/actions/workflow/status/seisigmasrl/dgii-rnc-validator/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/seisigmasrl/dgii-rnc-validator/actions/workflows/run-tests.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/seisigmasrl/dgii-rnc-validator.svg?style=flat-square)](https://packagist.org/packages/seisigmasrl/dgii-rnc-validator)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fseisigmasrl%2Fdgii-rnc-validator.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fseisigmasrl%2Fdgii-rnc-validator?ref=badge_shield)\n\nA simple package to check a given RNC with the official Tax Authority, Dirección General de Impuestos Internos (DGII), in the Dominican Republic and few more options.\n\n## Requirements\n\n- PHP \u003e= 8.1\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require seisigmasrl/dgii-rnc-validator\n```\n\n## Usage\nThis package aims to bring you a simple way to check and validate if a given RNC is valid and its current status with the tax authorities.\nMost existing solutions are based on parsing a monthly shared file with all the existing RNC by the Dirección General de Impuestos Internos (DGII), the official Tax Authority in the Dominican Republic.\n\nThis approach is excellent for improving performance, but it's not optimal for services requiring live, trusted information. For this reason, the current package provides a simple API to:\n- Validate RNC's\n- Verify if the given RNC is valid.\n\nThe package fetches data directly from the official DGII web portal to ensure you always get up-to-date information.\n\nHere's the list of the provided methods by this package:\n\n### Check\nValidate if a given RNC is valid and returns the details of the Taxpayer, or `false` if not found.\u003cbr\u003e\n__How to use it:__\n```php\nuse Seisigma\\DgiiRncValidator\\DgiiRncValidator;\n\n// 132620951 is a valid RNC\n$validatedRnc = DgiiRncValidator::check(\"132620951\");\nvar_dump($validatedRnc);\n\n// array(4) {\n//    [\"rnc\"]=\u003e string(9) \"132620951\"\n//    [\"name\"]=\u003e string(29) \"KOI CORPORATION BY SAIKOV SRL\"\n//    [\"commercial_name\"]=\u003e string(25) \"KOI CORPORATION BY SAIKOV\"\n//    [\"status\"]=\u003e string(6) \"ACTIVO\"\n// }\n\n// 123456789 is not registered in DGII\n$validatedRnc = DgiiRncValidator::check(\"123456789\");\nvar_dump($validatedRnc); // bool(false)\n```\n\n### validateRNC\nValidate if a given string has a valid RNC format (9 digits) or Cedula format (11 digits).\u003cbr\u003e\n__How to use it:__\n```php\nuse Seisigma\\DgiiRncValidator\\DgiiRncValidator;\n\n$validatedRnc = DgiiRncValidator::validateRNC(\"132620951\");\nvar_dump($validatedRnc); // bool(true) - valid 9-digit RNC format\n\n$validatedRnc = DgiiRncValidator::validateRNC(\"12345678901\");\nvar_dump($validatedRnc); // bool(true) - valid 11-digit Cedula format\n\n$validatedRnc = DgiiRncValidator::validateRNC(\"12345\");\nvar_dump($validatedRnc); // bool(false) - invalid format\n```\n\n### rncType\nReturns the type of identifier (RNC or Cedula) based on the string length.\u003cbr\u003e\n__How to use it:__\n```php\nuse Seisigma\\DgiiRncValidator\\DgiiRncValidator;\nuse Seisigma\\DgiiRncValidator\\helpers\\Types;\n\n// 9-digit identifier = RNC (business)\n$rncType = DgiiRncValidator::rncType(\"132620951\");\nvar_dump($rncType); // enum(Types::RNC)\n\n// 11-digit identifier = Cedula (person)\n$rncType = DgiiRncValidator::rncType(\"04800009577\");\nvar_dump($rncType); // enum(Types::CEDULA)\n\n// Invalid format returns false\n$rncType = DgiiRncValidator::rncType(\"12345\");\nvar_dump($rncType); // bool(false)\n```\n\nThe Types enum includes two functions:\n- `toString`: Return the string value from the returned enum.\nEx:\n```php\nvar_dump(Types::RNC-\u003etoString()) // string(RNC)\n```\n- `toCode`: Return the DGII type code value from the returned enum.\n  Ex:\n```php\nvar_dump(Types::RNC-\u003etoCode()) // string(01)\n```\n\n## Helper Functions\nJust in case you need a few extra tools, here's a list of utility functions:\n\n### getNumbers\nThis function returns all numbers from any provided string.\u003cbr\u003e\n__How to use it:__\n\n```php\nuse Seisigma\\DgiiRncValidator\\helpers\\Utils;\n\n$results = Utils::getNumbers(\"abc123456\");\nvar_dump($results); // string(6) \"123456\"\n\n$results = Utils::getNumbers(\"asdfasdfs\");\nvar_dump($results); // bool(false)\n```\n\n### luhnAlgorithmValidation\nThis function validates if the given sequence of digits has a valid key (checksum).\u003cbr\u003e\n__How to use it:__\n\n```php\nuse Seisigma\\DgiiRncValidator\\helpers\\Utils;\n\n$result = Utils::luhnAlgorithmValidation(\"79927398713\");\nvar_dump($result); // bool(true)\n\n$result = Utils::luhnAlgorithmValidation(\"79927398715\");\nvar_dump($result); // bool(false)\n```\n\n### validateDominicanCitizenId\nThis function validates if the given sequence of digits is a valid Dominican Citizen Id.\u003cbr\u003e\n__How to use it:__\n\n```php\nuse Seisigma\\DgiiRncValidator\\helpers\\Utils;\n\n$result = Utils::validateDominicanCitizenId(\"04800009575\");\nvar_dump($result); // bool(true)\n\n$result = Utils::validateDominicanCitizenId(\"04800009577\");\nvar_dump($result); // bool(false)\n```\n\n## Exception Handling\n\nThe `check()` method may throw exceptions when there are issues connecting to the DGII service:\n\n```php\nuse Seisigma\\DgiiRncValidator\\DgiiRncValidator;\nuse Seisigma\\DgiiRncValidator\\Exceptions\\DgiiServiceException;\n\ntry {\n    $result = DgiiRncValidator::check(\"132620951\");\n} catch (InvalidArgumentException $e) {\n    // Invalid RNC format provided\n} catch (DgiiServiceException $e) {\n    // Service-related error (connection failed, access denied, timeout, etc.)\n    echo $e-\u003egetMessage();\n}\n```\n\nThe `DgiiServiceException` is thrown in the following scenarios:\n- **Connection failed**: Unable to connect to DGII service\n- **Access denied**: Request was blocked by DGII (403 error)\n- **Invalid page structure**: The DGII website structure has changed\n- **Timeout**: Request to DGII service timed out\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Ricardo A. Vargas R.](https://github.com/ricardov03)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fseisigmasrl%2Fdgii-rnc-validator.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fseisigmasrl%2Fdgii-rnc-validator?ref=badge_large)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseisigmasrl%2Fdgii-rnc-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseisigmasrl%2Fdgii-rnc-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseisigmasrl%2Fdgii-rnc-validator/lists"}