Skip to content

mittmedia/personnummer-php

 
 

Repository files navigation

personnummer Build Status

Validate Swedish social security numbers.

Installation

composer require frozzare/personnummer

Examples

Validation

use Frozzare\Personnummer\Personnummer;

Personnummer::valid(6403273813);
//=> true

Personnummer::valid('19130401+2931');
//=> true

Format

use Frozzare\Personnummer\Personnummer;

// Short format (YYMMDD-XXXX)
Personnummer::format(6403273813);
//=> 640327-3813

// Long format (YYYYMMDDXXXX)
Personnummer::format('6403273813', true);
//=> 196403273813

See PersonnummerTest.php for more examples.

License

MIT

About

Validate Swedish social security numbers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%