Download the PHP package fredbradley/php-nhs-number without Composer

On this page you can find all versions of the php package fredbradley/php-nhs-number. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-nhs-number

NHS Numbers

Latest Version on Packagist Build Status Code Quality Code Coverage Total Downloads

Utility class to validate, format and generate NHS numbers.

🤔 F.A.Q.

What is an NHS number?

An "NHS number" is a unique identifier that every individual patient registered with Great Britain's National Health Service (NHS) has.

You can find out more about NHS numbers on the nhs.uk website.

How do you validate an NHS number?

Not every number is a valid NHS number - they must conform to a simple algorithm to be considered valid. Before the algorithm is run, there are a few things to note about NHS numbers:

The algorithm to validate an NHS number using its "check digit" is as follows:

  1. Multiple each of the first nine digits by a defined weight, shown below:
Original digit Multiplied by
1 10
2 9
3 8
4 7
5 6
6 5
7 4
8 3
9 2
  1. Calculate the sum of all 9 multiplications
  2. Divide this sum by 11 and get the remainder
  3. Subtract 11 from the remainder to get the total
  4. If the total is 11 then the identifier, otherwise the identifier is the total
  5. If the identifier is 10, then the NHS number is wrong
  6. If the identifier is the same as the check digit, then the NHS number is correct

💾 Installation

You can install the package with Composer using the following command:

📝 Usage

You can new up the NhsNumber object by passing through an NHS number.

The NHS recommend that when displaying an NHS number to a human, it should be spaced out in a 3-3-4 format, which helps it to be easier to read. To do this, call the ->format() method or cast the object to a string.

To get a boolean representation of whether or not the current number is valid, call the ->isValid() method on the object.

If you need more information on why a given NHS number may be invalid, you can call the ->validate() method directly. This will throw an InvalidNhsNumberException exception whose message will explain why the number is not valid.

To generate a single or multiple random valid NHS numbers for testing purposes, call the ::getRandomNumber() or ::getRandomNumbers($count) static methods respectively.

✅ Testing

🔖 Changelog

Please see the changelog file for more information on what has changed recently.

⬆️ Upgrading

Please see the upgrading file for details on upgrading from previous versions.

🎉 Contributing

Please see the code of conduct for details on contributing to the project.

🔒 Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

👷 Credits

♻️ License

The MIT License (MIT). Please see the license file for more information.


All versions of php-nhs-number with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fredbradley/php-nhs-number contains the following files

Loading the files please wait ....