adaptivemedia / laravel-pnr-validator by viirre

Validate a swedish personnummer in Laravel
11,009
0
2
Package Data
Maintainer Username: viirre
Maintainer Contact: victor@adaptivemedia.se (Victor Eliasson)
Package Create Date: 2016-08-11
Package Last Update: 2022-10-04
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-15 15:25:40
Package Statistics
Total Downloads: 11,009
Monthly Downloads: 38
Daily Downloads: 1
Total Stars: 0
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

Validate Swedish Personal Identity Numbers

Installation

Install the package with Composer via the command line:

composer require adaptivemedia/laravel-pnr-validator

This package has auto discovery so you don't need to add the Service Provider.

Usage

Use it like any Validator rule:

$rules = [
    'field' => 'pnr',
];
$rules = [
    'field' => new PersonalIdentityNumber()
];

See the Validation documentation of Laravel.

Valid formats

  • YYYYMMDD-XXXX
  • YYMMDD-XXXX
  • YYYYMMDDXXXX
  • YYMMDDXXXX
  • XXXXXX-XXXX (organization, TODO)
  • XXXXXXXXXX (organization, TODO)