2017 © Pedro PelĂĄez
 

library bekrafta

Validate Personal Numbers

image

miladk/bekrafta

Validate Personal Numbers

  • Thursday, December 28, 2017
  • by MiladK
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3,967 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 26 % Grown

The README.md

BekrÀfta Build Status

BekrÀfta: A PHP library to perform common operations on Personal Identification Numbers, like: Validation, censoring the individual digits, calculating age and detecting gender., (*1)

Supported Countries

  • Denmark (CPR-Nummer)
  • Finland (Henkilötunnus, Personbeteckning)
  • Poland (PESEL)
  • Netherlands (Burgerservicenummer) Validation only
  • Norway (FĂždselsnummer)
  • Sweden (Personnummer)

Supported Countries, (*2)

Supported PHP Versions

  • PHP 7.0
  • PHP 7.1
  • PHP 7.2

Installation

composer require miladk/bekrafta

Usage

This library offers one interface for all supported countries. Developers don't have to use specific countries' classes, instead there is one class that detects and uses the country and serves the appropriate values., (*3)

use Bekrafta\PersonalNumber;

$oPN = new PersonalNumber('811228-9874');

// True on successful detection, false otherwise.
// True also means a valid personal number.
$oPN->detect();

// 811228-****
$oPN->getCensored();

// 35
$oPN->getAge();

// m
$oPN->getGender();

// 1981
$oPM->getYear();

// 1981-12-28
$oPM->getBirthday()

Or you can use a specific country if you only need that., (*4)

use Bekrafta\Sweden;

$oSweden = new Sweden('811228-9874');

// True on valid personal number, false otherwise.
$oSweden->validate();

// 811228-****
$oSweden->getCensored();

// 35
$oSweden->getAge();

// m
$oSweden->getGender();

// 1981
$oSweden->getYear();

// 1981-12-28
$oSweden->getBirthday();

Sweden Extended

In Sweden, some companies add the century digits as a part of the personal number, or remove the symbol between the date of birth and the four other digits. These changes are not part of the standard of the official standard. So I included to classes for Sweden: - Sweden: Supports the official standard format. - SwedenExtended: Supports the popular non-standard formats. This has two more functions: - removeLeadingCenturies() it removes the leading 19 or 20 from the personal number. - removeNonNumbers() Removes non-numeric characters form personal number., (*5)

Denmark Strict

However, in 2007 the available sequence numbers under this system for males born on 1 January 1965 ran out, and since October 2007 personal identification numbers do not always validate using the check digit. This had been predicted and announced several years in advance. Thus, most IT systems are presumed updated to accept numbers that fail the check-digit validation. — Wikipedia, (*6)

Therefore, I see no use for performing a checksum on Danish personal numbers, because we will get false negatives. However, if you want to use the checksum, you can use the class DenmarkStrict which performs the checksum on the personal number, you will get false positives though., (*7)

License

MIT, (*8)

The Versions

28/12 2017

dev-master

9999999-dev

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

28/12 2017

v1.2.1

1.2.1.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

15/10 2017

v1.2.0

1.2.0.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

11/10 2017

v1.1.0

1.1.0.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

22/09 2017

v1.0.0

1.0.0.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

21/09 2017

v0.3.4

0.3.4.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

20/09 2017

v0.3.3

0.3.3.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

18/09 2017

v0.3.2

0.3.2.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

17/09 2017

v0.3.1

0.3.1.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

17/09 2017

v0.3.0

0.3.0.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

27/02 2017

v0.2.3

0.2.3.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

27/02 2017

0.2.1

0.2.1.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale

27/02 2017

0.2.2

0.2.2.0

Validate Personal Numbers

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Addu Cloud
by Milad Kawas Cale