docsbr-br 1.0.1

dotnet add package docsbr-br --version 1.0.1
                    
NuGet\Install-Package docsbr-br -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="docsbr-br" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="docsbr-br" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="docsbr-br" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add docsbr-br --version 1.0.1
                    
#r "nuget: docsbr-br, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package docsbr-br@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=docsbr-br&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=docsbr-br&version=1.0.1
                    
Install as a Cake Tool

DocsBR - Brazilian Document Validation Library

A lightweight, independent .NET library for validating Brazilian documents without external dependencies.

Features

CPF - Brazilian individual taxpayer ID validation
CNPJ - Brazilian company taxpayer ID validation
Phone - Brazilian phone number validation with real DDDs
RG - Brazilian identity document validation
CEP - Brazilian postal code validation
CNH - Brazilian driver license validation

Installation

dotnet add package docsbr-br

Or via Package Manager Console:

Install-Package docsbr-br

Or add to your .csproj:

<ItemGroup>
    <PackageReference Include="docsbr-br" Version="1.0.0" />
</ItemGroup>

Quick Start

using DocsBR.Library;

var docsbr = new DocsbrValidator();

// Validate CPF
bool isValidCpf = docsbr.ValidarCpf("123.456.789-09");

// Validate CNPJ
bool isValidCnpj = docsbr.ValidarCnpj("12.345.678/0001-90");

// Validate Phone
bool isValidPhone = docsbr.ValidarTelefone("(11) 98765-4321");

// Validate RG
bool isValidRg = docsbr.ValidarRg("123456789");

// Validate CEP
bool isValidCep = docsbr.ValidarCep("01310-100");

// Validate CNH
bool isValidCnh = docsbr.ValidarCnh("12345678901");

// Generic validation method
bool isValid = docsbr.Validar("cpf", "123.456.789-09");

Validation Details

CPF (Individual Taxpayer ID)

  • Format: XXX.XXX.XXX-XX (11 digits)
  • Check: Official algorithm with modulo-11
  • Rejects: Sequential digits (111.111.111-11)

CNPJ (Company Taxpayer ID)

  • Format: XX.XXX.XXX/XXXX-XX (14 digits)
  • Check: Official algorithm with weighted multiplication
  • Validation: Complete check-digit verification

Phone (Telefone)

  • Format: Supports multiple formats with DDD
  • DDD: Validates against all 27 Brazilian area codes
  • Types: Supports fixed (10 digits) and mobile (11 digits with 9)

RG (Identity Document)

  • Format: 7-9 digits with optional final X
  • Standard: SP (São Paulo) check-digit algorithm
  • Validation: Digit verification based on official rules

CEP (Postal Code)

  • Format: XXXXX-XXX or 8 digits
  • Range: 01000-000 to 99999-999
  • Rejects: Invalid sequences and out-of-range codes

CNH (Driver License)

  • Format: 11 digits
  • Check: Complex 2-digit verification with DSC (desconto) adjustment
  • Validation: Official CNH algorithm

Features Highlight

🔒 No External Dependencies - Pure .NET validation logic
High Performance - Optimized algorithms
🇧🇷 Official Standards - Uses official Brazilian government algorithms
Comprehensive - Validates 6 document types
📝 Easy to Use - Simple, intuitive API

License

MIT License

Author

Igor Pieralini

Support

For issues and feature requests, visit: https://github.com/igorpieralini/docsbr-API

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 151 12/6/2025
1.0.0 141 12/6/2025