Cnpj

February 4, 2026 · View on GitHub

  • Cnpj()

Validates the structure and mathematical integrity of Brazilian CNPJ identifiers. Ignores non-digit chars, so use ->digit() if needed.

v::cnpj()->assert('00394460005887');
// Validation passes successfully

v::cnpj()->assert('12ABC34501DE35');
// Validation passes successfully

Templates

Cnpj::TEMPLATE_STANDARD

ModeTemplate
default{{subject}} must be a CNPJ
inverted{{subject}} must not be a CNPJ

Template placeholders

PlaceholderDescription
subjectThe validated input or the custom validator name (if specified).

Categorization

  • Identifications

Changelog

VersionDescription
3.0.0Templates changed
0.3.9Created

See Also