adaptivemedia/laravel-pnr-validator

Validate a swedish personnummer in Laravel

1.2.0 2022-10-04 05:43 UTC

This package is auto-updated.

Last update: 2024-11-04 09:52:24 UTC


README

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)