PHPackages                             phprsa/id-validator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. phprsa/id-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

phprsa/id-validator
===================

Professional South African RSA ID Number Validation Library with Luhn algorithm, date validation, and component extraction

v1.3.0(5mo ago)021MITPHPPHP ^8.0CI passing

Since Nov 25Pushed 1mo agoCompare

[ Source](https://github.com/nkenjana/phprsa)[ Packagist](https://packagist.org/packages/phprsa/id-validator)[ Docs](https://github.com/phprsa/id-validator)[ RSS](/packages/phprsa-id-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

```
# **PHP RSA ID Validator**
```

[![PHP Version](https://camo.githubusercontent.com/d4b5fa4adf514144779a7864904c5e15236c0e798635240c7f6ce9a455657b80/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302532422d626c75652e737667)](https://camo.githubusercontent.com/d4b5fa4adf514144779a7864904c5e15236c0e798635240c7f6ce9a455657b80/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302532422d626c75652e737667)[![License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)[![Packagist](https://camo.githubusercontent.com/d2785606f72cd5bed695473d3a9834a0f56d16677d7d3254c285b826ecb2f1cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5061636b61676973742d52656164792d6f72616e67652e737667)](https://camo.githubusercontent.com/d2785606f72cd5bed695473d3a9834a0f56d16677d7d3254c285b826ecb2f1cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5061636b61676973742d52656164792d6f72616e67652e737667)

A professional, lightweight PHP library for validating South African ID numbers. It performs full structural checks, validates birth dates, determines gender, identifies citizenship, and verifies the Luhn check digit. Ideal for forms, authentication systems, HR platforms, and any application requiring reliable South African ID verification.

---

Features
--------

[](#features)

- Validates full RSA ID format (YYMMDDSSSGC A)
- Birth date extraction with automatic century detection
- Gender identification based on sequence number
- Citizen vs resident status
- Full Luhn algorithm check digit validation
- JSON API support

---

Installation
------------

[](#installation)

### Using Composer

[](#using-composer)

```
composer require phprsa/id-validator
```

### Manual Load

[](#manual-load)

If you’re not using Composer, include the file directly:

```
require 'vendor/phprsa/id-validator/src/RsaIdValidator.php';
```

---

Usage Example
-------------

[](#usage-example)

```
use PhpRsaIdValidator\RsaIdValidator;

$validator = new RsaIdValidator();
$result = $validator->validate('9001014800085');

if ($result['valid']) {
    echo "ID is valid";
} else {
    echo "Error: " . $result['error'];
}
```

---

API Endpoint
------------

[](#api-endpoint)

This project includes a working API endpoint for remote validation.

### `id-api.php`

[](#id-apiphp)

```
