PHPackages                             seisigmasrl/dgii-rnc-validator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. seisigmasrl/dgii-rnc-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

seisigmasrl/dgii-rnc-validator
==============================

A simple package to check a given RNC with the official Tax Authority, Dirección General de Impuestos Internos (DGII), in the Dominican Republic.

v2.0.1(3mo ago)81.2k4[3 PRs](https://github.com/seisigmasrl/dgii-rnc-validator/pulls)MITPHPPHP &gt;=8.1CI passing

Since Jan 21Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/seisigmasrl/dgii-rnc-validator)[ Packagist](https://packagist.org/packages/seisigmasrl/dgii-rnc-validator)[ Docs](https://github.com/seisigmasrl/dgii-rnc-validator)[ GitHub Sponsors](https://github.com/ricardov03)[ RSS](/packages/seisigmasrl-dgii-rnc-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (16)Used By (0)

Validate any RNC with the DGII
==============================

[](#validate-any-rnc-with-the-dgii)

[![Latest Version on Packagist](https://camo.githubusercontent.com/96171d70423bbf17df84b63707fb04b4bf434c03dc3345524648ead772ba2611/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365697369676d6173726c2f646769692d726e632d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/seisigmasrl/dgii-rnc-validator)[![Tests](https://camo.githubusercontent.com/be416fc0fcf2076d87322beb6656c89611f157f3a512a3828165987e8b4181d4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7365697369676d6173726c2f646769692d726e632d76616c696461746f722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/seisigmasrl/dgii-rnc-validator/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/ae822e9fe86944f37318745c32e1b47bc82db0f1d7588142c5aa432651bf0e21/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7365697369676d6173726c2f646769692d726e632d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/seisigmasrl/dgii-rnc-validator)[![FOSSA Status](https://camo.githubusercontent.com/143fed042ccc92809736e154ef701402a96a8fedb86da59167123f0a5362479f/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532467365697369676d6173726c253246646769692d726e632d76616c696461746f722e7376673f747970653d736869656c64)](https://app.fossa.com/projects/git%2Bgithub.com%2Fseisigmasrl%2Fdgii-rnc-validator?ref=badge_shield)

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
------------

[](#requirements)

- PHP &gt;= 8.1

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require seisigmasrl/dgii-rnc-validator
```

Usage
-----

[](#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

[](#check)

Validate if a given RNC is valid and returns the details of the Taxpayer, or `false` if not found.
**How to use it:**

```
use Seisigma\DgiiRncValidator\DgiiRncValidator;

// 132620951 is a valid RNC
$validatedRnc = DgiiRncValidator::check("132620951");
var_dump($validatedRnc);

// array(4) {
//    ["rnc"]=> string(9) "132620951"
//    ["name"]=> string(29) "KOI CORPORATION BY SAIKOV SRL"
//    ["commercial_name"]=> string(25) "KOI CORPORATION BY SAIKOV"
//    ["status"]=> string(6) "ACTIVO"
// }

// 123456789 is not registered in DGII
$validatedRnc = DgiiRncValidator::check("123456789");
var_dump($validatedRnc); // bool(false)
```

### validateRNC

[](#validaternc)

Validate if a given string has a valid RNC format (9 digits) or Cedula format (11 digits).
**How to use it:**

```
use Seisigma\DgiiRncValidator\DgiiRncValidator;

$validatedRnc = DgiiRncValidator::validateRNC("132620951");
var_dump($validatedRnc); // bool(true) - valid 9-digit RNC format

$validatedRnc = DgiiRncValidator::validateRNC("12345678901");
var_dump($validatedRnc); // bool(true) - valid 11-digit Cedula format

$validatedRnc = DgiiRncValidator::validateRNC("12345");
var_dump($validatedRnc); // bool(false) - invalid format
```

### rncType

[](#rnctype)

Returns the type of identifier (RNC or Cedula) based on the string length.
**How to use it:**

```
use Seisigma\DgiiRncValidator\DgiiRncValidator;
use Seisigma\DgiiRncValidator\helpers\Types;

// 9-digit identifier = RNC (business)
$rncType = DgiiRncValidator::rncType("132620951");
var_dump($rncType); // enum(Types::RNC)

// 11-digit identifier = Cedula (person)
$rncType = DgiiRncValidator::rncType("04800009577");
var_dump($rncType); // enum(Types::CEDULA)

// Invalid format returns false
$rncType = DgiiRncValidator::rncType("12345");
var_dump($rncType); // bool(false)
```

The Types enum includes two functions:

- `toString`: Return the string value from the returned enum. Ex:

```
var_dump(Types::RNC->toString()) // string(RNC)
```

- `toCode`: Return the DGII type code value from the returned enum. Ex:

```
var_dump(Types::RNC->toCode()) // string(01)
```

### Status Enum

[](#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.

```
use Seisigma\DgiiRncValidator\helpers\Status;

// Convert a string to Status enum
$status = Status::fromString("ACTIVO");
var_dump($status); // enum(Status::ACTIVE)

// Get the string representation
var_dump(Status::ACTIVE->toString()); // string(6) "ACTIVO"
```

Available status values:

EnumString ValueDescription`Status::ACTIVE`ACTIVOActive taxpayer`Status::INACTIVE`INACTIVOInactive taxpayer`Status::SUSPENSE`SUSPENDIDOSuspended taxpayer`Status::DECOMMISSIONED`DADO DE BAJADecommissioned taxpayerHelper Functions
----------------

[](#helper-functions)

Just in case you need a few extra tools, here's a list of utility functions:

### getNumbers

[](#getnumbers)

This function returns all numbers from any provided string.
**How to use it:**

```
use Seisigma\DgiiRncValidator\helpers\Utils;

$results = Utils::getNumbers("abc123456");
var_dump($results); // string(6) "123456"

$results = Utils::getNumbers("asdfasdfs");
var_dump($results); // bool(false)
```

### luhnAlgorithmValidation

[](#luhnalgorithmvalidation)

This function validates if the given sequence of digits has a valid key (checksum).
**How to use it:**

```
use Seisigma\DgiiRncValidator\helpers\Utils;

$result = Utils::luhnAlgorithmValidation("79927398713");
var_dump($result); // bool(true)

$result = Utils::luhnAlgorithmValidation("79927398715");
var_dump($result); // bool(false)
```

### validateDominicanCitizenId

[](#validatedominicancitizenid)

This function validates if the given sequence of digits is a valid Dominican Citizen Id.
**How to use it:**

```
use Seisigma\DgiiRncValidator\helpers\Utils;

$result = Utils::validateDominicanCitizenId("04800009575");
var_dump($result); // bool(true)

$result = Utils::validateDominicanCitizenId("04800009577");
var_dump($result); // bool(false)
```

Exception Handling
------------------

[](#exception-handling)

The `check()` method may throw exceptions when there are issues connecting to the DGII service:

```
use Seisigma\DgiiRncValidator\DgiiRncValidator;
use Seisigma\DgiiRncValidator\Exceptions\DgiiServiceException;

try {
    $result = DgiiRncValidator::check("132620951");
} catch (InvalidArgumentException $e) {
    // Invalid RNC format provided
} catch (DgiiServiceException $e) {
    // Service-related error (connection failed, access denied, timeout, etc.)
    echo $e->getMessage();
}
```

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
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ricardo A. Vargas R.](https://github.com/ricardov03)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[![FOSSA Status](https://camo.githubusercontent.com/9a660f6bd537810bb27ae8f31b4b39dec2cf71cf479fe7f8f72f5fdbdef00858/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532467365697369676d6173726c253246646769692d726e632d76616c696461746f722e7376673f747970653d6c61726765)](https://app.fossa.com/projects/git%2Bgithub.com%2Fseisigmasrl%2Fdgii-rnc-validator?ref=badge_large)

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance81

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 56.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~111 days

Recently: every ~272 days

Total

11

Last Release

101d ago

Major Versions

1.1.7 → v2.0.02026-02-01

PHP version history (2 changes)1.0.0PHP ^8.1

1.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0dbf2b5563c4ce6ead1b041f6d25526054fd443dddba5d161b72d01708ddc611?d=identicon)[seisigma](/maintainers/seisigma)

---

Top Contributors

[![ricardov03](https://avatars.githubusercontent.com/u/2243870?v=4)](https://github.com/ricardov03 "ricardov03 (44 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (18 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (14 commits)")[![elminson](https://avatars.githubusercontent.com/u/2476286?v=4)](https://github.com/elminson "elminson (1 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")

---

Tags

phprncvalidatorseisigmasrldgii-rnc-validator

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/seisigmasrl-dgii-rnc-validator/health.svg)

```
[![Health](https://phpackages.com/badges/seisigmasrl-dgii-rnc-validator/health.svg)](https://phpackages.com/packages/seisigmasrl-dgii-rnc-validator)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
