Download the PHP package safeaccess/identum without Composer

On this page you can find all versions of the php package safeaccess/identum. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package identum

safeaccess-identum logo

Safe Access Identum — PHP

PHP library for validating Brazilian documents — CPF, CNPJ, CNH, CEP, CNS, PIS, IE (all 27 states), RENAVAM, Mercosul Plate, Voter Title, Payment Card, PIX key, and Certificate. Input sanitization by default. Zero production dependencies.

Packagist PHP 8.2+ PHPStan level 9 Tested with Pest Infection MSI


Version 2.0. validate() now returns a rich result object instead of a boolean, with new capabilities (format, generate, metadata) and document types. Upgrading from 1.x? See Migrating from 1.x.

Features

The problem

Validating Brazilian documents in PHP accumulates silently: scattered regexes, copy-pasted Mod-11 loops, and 27 state-specific IE algorithms scattered across the codebase. Each re-implementation gets Bahia's dual-modulus branch wrong and ships with no edge-case tests.

Without this library:

With this library:

Installation

Requirements: PHP 8.2+

Quick start

Direct instantiation

API

All validator classes share the same fluent interface after construction:

Method Return Description
validate() ValidationResult Rich result: { valid, reason, normalized, meta }
isValid() bool Boolean shortcut for validate()->valid
validateOrFail() void Throws ValidationException (with document, reason, normalized) when invalid
format() string Canonical mask applied, best-effort
strip() string Canonical value with mask characters removed
denyList(string[]) static Force-reject the specified values regardless of checksum
allowList(string[]) static Force-accept the specified values regardless of checksum
raw() string The input exactly as provided

blacklist() / whitelist() still work as deprecated aliases of denyList() / allowList() and will be removed in 3.0.

Reason codes (stable, snake_case), in the order they are checked: invalid_format → wrong_length → bad_check_digit → unknown_uf → known_invalid → denied.

Generators — one per type on the facade: generateCpf(), generateCnpj(), generateCnh(), generateCep(), generateCns(), generatePis(), generateIe($state), generateRenavam(), generatePlaca(), generateTituloEleitor(). Unmasked by default; pass formatted: true where a mask exists.

Supported documents

Document Alias Class
CPF cpf CPFValidation
CNPJ cnpj CNPJValidation
CNH cnh CNHValidation
CEP cep CEPValidation
CNS cns CNSValidation
PIS/PASEP pis PISValidation
IE ie IEValidation
RENAVAM renavam RenavamValidation
Mercosul Plate placa PlateMercosulValidation
Voter Title tituloEleitor VoterTitleValidation
Payment Card cartao CartaoValidation
PIX key pix PixValidation
Certificate certidao CertidaoValidation

IE — all 27 states

CNPJ — alfanumérico

Payment Card, PIX and Certificate

Card validation is Luhn integrity plus best-effort brand — it does not prove a card exists (that needs an online lookup). PIX validates key format (and CPF/CNPJ checksums), not DICT registration. Both are offline by design.

Contributing

See CONTRIBUTING.md for development setup, commit conventions, and pull request guidelines.

License

MIT © Felipe Sauer


All versions of identum with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package safeaccess/identum contains the following files

Loading the files please wait ...