Download the PHP package seisigmasrl/dgii-rnc-validator without Composer
On this page you can find all versions of the php package seisigmasrl/dgii-rnc-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download seisigmasrl/dgii-rnc-validator
More information about seisigmasrl/dgii-rnc-validator
Files in seisigmasrl/dgii-rnc-validator
Package dgii-rnc-validator
Short 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.
License MIT
Homepage https://github.com/seisigmasrl/dgii-rnc-validator
Informations about the package dgii-rnc-validator
Validate any RNC with the DGII
A 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.
Requirements
- PHP >= 8.1
Installation
You can install the package via composer:
Usage
This 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. Most 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.
This 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:
- Validate RNC's
- Verify if the given RNC is valid.
The package fetches data directly from the official DGII web portal to ensure you always get up-to-date information.
Here's the list of the provided methods by this package:
Check
Validate if a given RNC is valid and returns the details of the Taxpayer, or false if not found.
How to use it:
validateRNC
Validate if a given string has a valid RNC format (9 digits) or Cedula format (11 digits).
How to use it:
rncType
Returns the type of identifier (RNC or Cedula) based on the string length.
How to use it:
The Types enum includes two functions:
-
toString: Return the string value from the returned enum. Ex: toCode: Return the DGII type code value from the returned enum. Ex:
Status Enum
The check() method returns the taxpayer status as a normalized string. You can also use the Status enum directly to work with status values.
| Available status values: | Enum | String Value | Description |
|---|---|---|---|
Status::ACTIVE |
ACTIVO | Active taxpayer | |
Status::INACTIVE |
INACTIVO | Inactive taxpayer | |
Status::SUSPENSE |
SUSPENDIDO | Suspended taxpayer | |
Status::DECOMMISSIONED |
DADO DE BAJA | Decommissioned taxpayer |
Helper Functions
Just in case you need a few extra tools, here's a list of utility functions:
getNumbers
This function returns all numbers from any provided string.
How to use it:
luhnAlgorithmValidation
This function validates if the given sequence of digits has a valid key (checksum).
How to use it:
validateDominicanCitizenId
This function validates if the given sequence of digits is a valid Dominican Citizen Id.
How to use it:
Exception Handling
The check() method may throw exceptions when there are issues connecting to the DGII service:
The DgiiServiceException is thrown in the following scenarios:
- Connection failed: Unable to connect to DGII service
- Access denied: Request was blocked by DGII (403 error)
- Invalid page structure: The DGII website structure has changed
- Timeout: Request to DGII service timed out
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Ricardo A. Vargas R.
- All Contributors
License
The MIT License (MIT). Please see License File for more information.