Skip to content

A simple PHP class to validate a NHS Number and return a correctly formatted version.

License

Notifications You must be signed in to change notification settings

CloudDataService/nhs-number-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NHS Number Validation

Build Status Total Downloads Version License

A simple PHP class to validate a NHS Number and return a correctly formatted version.

Requirements

  • PHP >= 5.3.3

Example

<?php

// include the autoloader
include __DIR__ . '/vendor/autoload.php';

// setup our validator
$nhsValidator = new \CloudDataService\NHSNumberValidation\Validator;

// start with our test NHS number (usually taken via user input)
$nhs_no = '401 023 2137';

try {
    $valid_nhs_no = $nhsValidator->valdate($nhs_no);
} catch (\CloudDataService\NHSNumberValidation\InvalidNumberException $e) {
    die($e->getMessage() . PHP_EOL);
}

if (!empty($valid_nhs_no)) {
    print "YAY! {$valid_nhs_no} is a valid NHS Number\r\n";
}

About

A simple PHP class to validate a NHS Number and return a correctly formatted version.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages