Download the PHP package gbielbarbosa/stdnum-php without Composer
On this page you can find all versions of the php package gbielbarbosa/stdnum-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gbielbarbosa/stdnum-php
More information about gbielbarbosa/stdnum-php
Files in gbielbarbosa/stdnum-php
Package stdnum-php
Short Description A PHP library to parse, validate and format standard numbers and identifiers.
License MIT
Informations about the package stdnum-php
stdnum-php
stdnum-php is a modern, framework-agnostic PHP 8.1+ library designed for parsing, formatting, and validating standard numbers and alphanumeric identifiers.
This project is an architectural port inspired by the robust python-stdnum library, featuring an object-oriented and extensible design structure natively built for the PHP ecosystem.
Features
- Extensive Coverage: Supports 106 international identification formats spanning across 71 countries.
- Fluent & Static Resolution: Simple dot-notation to dynamically map specific validators (e.g.
br.cpf,us.ssn,cn.uscc). - Laravel Integration Ready: Includes a native generic rule
StdNumRulethat tightly integrates into Laravel's FormRequests and validators. - Standardized Interfaces: All validators rigorously adhere to a single
DocumentInterfacecontract implementingvalidate(),isValid(),format(), andcompact().
Installation
You can install the package via composer:
Basic Usage
The library acts through a central StdNum factory or you can instance the classes independently.
Pure PHP
You can quickly evaluate identifiers using the dot notation format [iso-code].[identifier-type].
Laravel Usage
The package comes bundled with StdNumRule for seamless Laravel integration:
Formatting Identifiers
In addition to checks, each format provides natively tailored presentation routines:
Supported Formats
Currently supported and rigorously tested identifier types include:
- 🇦🇩 Andorra: NRT
- 🇦🇱 Albania: NIPT
- 🇦🇷 Argentina: CUIT, DNI, CBU
- 🇦🇹 Austria: UID, TIN
- 🇦🇺 Australia: ABN, ACN, TFN
- 🇦🇿 Azerbaijan: VOEN
- 🇧🇪 Belgium: NN, VAT
- 🇧🇬 Bulgaria: EGN, PNF, VAT
- 🇧🇾 Belarus: UNP
- 🇧🇷 Brazil: CPF, CNPJ
- 🇨🇦 Canada: SIN, BN
- 🇨🇭 Switzerland: SSN, UID, VAT
- 🇨🇱 Chile: RUT
- 🇨🇳 China: RIC, USCC
- 🇨🇴 Colombia: NIT
- 🇨🇷 Costa Rica: CPF, CPJ, CR
- 🇨🇺 Cuba: NI
- 🇨🇾 Cyprus: VAT
- 🇨🇿 Czech Republic: DIC, RC
- 🇩🇪 Germany: STNR, VAT
- 🇩🇰 Denmark: CPR, CVR
- 🇩🇴 Dominican Republic: CEDULA, RNC
- 🇪🇨 Ecuador: CI, RUC
- 🇪🇪 Estonia: IK, KMKR, REGISTRIKOOD
- 🇪🇸 Spain: CIF, DNI, NIE, NIF
- 🇫🇮 Finland: ALV, HETU, YTUNNUS
- 🇫🇷 France: SIREN, SIRET, TVA
- 🇬🇧 United Kingdom: NINO, UTR, VAT
- 🇬🇷 Greece: AMKA, VAT
- 🇬🇹 Guatemala: NIT
- 🇮🇩 Indonesia: NIK, NPWP
- 🇮🇪 Ireland: PPS, VAT
- 🇮🇱 Israel: HP, IDNR
- 🇮🇳 India: AADHAAR, EPIC, PAN
- 🇮🇸 Iceland: KENNITALA, VSK
- 🇮🇹 Italy: CodiceFiscale, IVA
- 🇯🇵 Japan: CN
- 🇰🇷 South Korea: BRN, RRN
- 🇱🇹 Lithuania: ASMENS, PVM
- 🇱🇺 Luxembourg: TVA
- 🇱🇻 Latvia: PVN
- 🇲🇨 Monaco: TVA
- 🇲🇩 Moldova: IDNO
- 🇲🇪 Montenegro: PIB
- 🇲🇰 North Macedonia: EDB
- 🇲🇹 Malta: VAT
- 🇲🇺 Mauritius: NID
- 🇲🇽 Mexico: CURP, RFC
- 🇲🇾 Malaysia: NRIC
- 🇳🇱 Netherlands: BRIN, BSN, BTW, Identiteitskaartnummer, Onderwijsnummer, Postcode
- 🇳🇴 Norway: Fodselsnummer, KontoNr, MVA, OrgNr
- 🇳🇿 New Zealand: BankAccount, IRD
- 🇵🇪 Peru: CUI, RUC
- 🇵🇱 Poland: NIP, PESEL, REGON
- 🇵🇹 Portugal: CC, NIF
- 🇵🇾 Paraguay: RUC
- 🇷🇴 Romania: CF, CNP, CUI, ONRC
- 🇷🇸 Serbia: PIB
- 🇷🇺 Russia: INN, OGRN
- 🇸🇪 Sweden: Orgnr, Personnummer, VAT
- 🇸🇬 Singapore: UEN
- 🇸🇮 Slovenia: DDV, EMSO
- 🇸🇰 Slovakia: DPH, RC
- 🇸🇲 San Marino: COE
- 🇸🇻 El Salvador: NIT
- 🇹🇷 Turkey: TCKimlik, VKN
- 🇺🇦 Ukraine: EDRPOU
- 🇺🇸 United States: ATIN, EIN, ITIN, PTIN, RTN, SSN
- 🇺🇾 Uruguay: RUT
- 🇻🇪 Venezuela: RIF
- 🇿🇦 South Africa: ID, TIN
Testing
The project incorporates PHPUnit. All formulas and checksums are deeply tested over boundary conditions spanning hundreds of assertions mirroring their native environments.
License
The MIT License (MIT). Please see License File for more information.