Skip to content

GovernmentPlates/PHP-NIValidator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP-NIValidator

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.