governmentplates/uk-national-insurance-validator

A simple and fast UK National Insurance Number Validator

1.0.0 2022-09-25 15:27 UTC

This package is auto-updated.

Last update: 2024-11-05 17:48:31 UTC


README

A simple and fast UK National Insurance (N.I.) Number Validator.

License Dependents

Installation

composer require governmentplates/uk-national-insurance-validator

Requirements: PHP 7 or newer.

Usage

<?php

use NIValidator\NationalInsurance;

$ni = new NationalInsurance('QQ123456C');
$ni->validate();

//validate() returns true if a given number is valid, or false otherwise.

How does it validate a N.I number?

This simple validator follows the logical rules for UK N.I. number formats, as seen in the HMRC Insurance Manual.

Is this safe? Is this going to leak my/or my users N.I. numbers?

Feel free to check the source code (located in the src/ directory).

License

GNU General Public License v3.0.