Search by

codaminds / identifiers

codediaz

Open-source multi-language library for validating national identifiers with a common specification.

Package info

github.com/Codaminds/identifiers-php

pkg:composer/codaminds/identifiers

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-08-17 00:41 UTC

This package is auto-updated.

Last update: 2026-09-17 00:55:54 UTC


README

PHP implementation of Codaminds Identifiers — Specification-driven national document validator.

License: MIT Latest Version on Packagist

Notice

⚠️ Read-only Subtree Split: This repository is a read-only mirror. Please submit issues and pull requests to the main monorepo at Codaminds/identifiers.

Installation

Requires PHP 8.2+.

composer require codaminds/identifiers

Usage

use Codaminds\Identifiers\Identifier;

// National ID (Cédula)
$isValidId = Identifier::isValid('EC', 'national-id', '0926687856');

// Tax ID (RUC - Natural, Public, or Private)
$isValidRuc = Identifier::isValid('EC', 'tax-id', '0926687856001');

// Detailed validation
$result = Identifier::validate('EC', 'tax-id', '0926687856000');
if (!$result->isValid) {
    echo $result->errorCode;    // 'INVALID_ESTABLISHMENT'
    echo $result->errorMessage; // 'Establishment code must be greater than zero'
}

Supported Identifiers

Country Identifier Code Support
🇪🇨 Ecuador Cédula de Identidad national-id ✅
🇪🇨 Ecuador Registro Único de Contribuyentes (RUC) tax-id ✅

Error Codes Reference

Error Code Description Applicable Identifiers
INVALID_FORMAT Value contains non-numeric characters or incorrect pattern national-id, tax-id
INVALID_LENGTH Length differs from the exact expected digit count national-id, tax-id
INVALID_PROVINCE_CODE Province code prefix is not between 01-24 or 30 national-id, tax-id
INVALID_THIRD_DIGIT Third digit is not within valid ranges for natural, public, or private entities national-id, tax-id
INVALID_ESTABLISHMENT Establishment branch code is 000 / 0000 (must be > 0) tax-id
INVALID_CHECKSUM Verification digit does not match algorithm validation national-id, tax-id

License

MIT © Codaminds.