robbens / sssn
Generates a valid Swedish social security number.
dev-master
2018-11-06 18:50 UTC
Requires (Dev)
- phpunit/phpunit: ^7.4
This package is auto-updated.
Last update: 2025-01-07 08:09:22 UTC
README
This package will generate a valid Swedish social security number. It looks something like this: 790631-2629
Installation
composer require robbens\sssn
Usage
Generate a random date and identifier.
$validSsn = Sssn::make(); // 351220-6537
Specify a date and identifier manually.
$validSsn = Sssn::make('890525', '12'); // 890525-1206
Note: The identifier is 4 numbers. However, only the first two can actually be 0-99.
Specify a gender.
$validMaleSsn = Sssn::make('890525')->male(); // 890525-4473 $validFemaleSsn = Sssn::make('890525')->female(); // 8905257948
Validate.
Sssn::validate('8011036301'); // true Sssn::validate('80/11/03-6301'); // true Sssn::validate('801103-6302'); // false
How the ssn is generated
TODO