PHPackages                             yomo/south-african-idnumber-generator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. yomo/south-african-idnumber-generator

Abandoned → [nonsapiens/south-african-id-number-faker](/?search=nonsapiens%2Fsouth-african-id-number-faker)Library[Utility &amp; Helpers](/categories/utility)

yomo/south-african-idnumber-generator
=====================================

Laravel package to help generate real and verifiable South African ID number sequences, allowing for customisable gender and dates of birth

v2.0.1(5mo ago)314MITPHP

Since Dec 23Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/nonsapiens/south-african-idnumber-generator)[ Packagist](https://packagist.org/packages/yomo/south-african-idnumber-generator)[ RSS](/packages/yomo-south-african-idnumber-generator/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (2)Versions (8)Used By (0)

RSA (South African) ID Number Generator
=======================================

[](#rsa-south-african-id-number-generator)

This PHP/Laravel Faker library generates valid South African ID numbers, adhering to the 13-digit format specified by the Department of Home Affairs. It is also able to validate RSA ID numbers, and provide information about the ID number holder.

The generated ID numbers include the date of birth, gender, citizenship status, and a checksum digit for validation.

Features
--------

[](#features)

- Generates valid South African ID numbers.
- Supports male and female gender identification.
- Includes citizenship status (South African citizen or permanent resident).

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- Laravel 9 or higher

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

[](#installation)

### Via Composer

[](#via-composer)

```
composer require nonsapiens/south-african-id-number-faker
```

Usage (Generation)
------------------

[](#usage-generation)

### With Faker

[](#with-faker)

```
class UserFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition(): array
    {
        return [
            'name' => $name,
            'email' => $this->faker->safeEmailAddress(),
            'rsa_id_number' => $this->faker->southAfricanIdNumber(),  # Completely random
            'email_verified_at' => Carbon::now(),
            'password' => bcrypt('12345'),
            'remember_token' => Str::random(10),
            'created_at' => Carbon::now(),
            'updated_at' => Carbon::now(),
            'last_accessed_at' => Carbon::now(),
            'is_active' => $this->faker->boolean(),
            'settings_json' => $this->faker->words(),
        ];
    }
}
```

You can also generate using:

**Specified details**

```
$this->faker->southAfricanIdNumber('1982-08-01', 'm');
```

**Gender specific**

```
$this->faker->southAfricanIdNumberFemale()
```

```
$this->faker->southAfricanIdNumberMale(Carbon::parse('1985-01-09'))
```

### Using the helper class

[](#using-the-helper-class)

```
use Illuminate\Support\Carbon;
use Nonsapiens\SouthAfricanIdNumberFaker;

// Example: Generate an ID for a male South African citizen born on 15 August 1995, using Carbon
$dateOfBirth = Carbon::createFromDate(1995, 8, 15);
$idNumber1 = RsaIdNumber::generateRsaIdNumber($dateOfBirth, 'm', true);

// Example: Generate for a female, random date of birth, non-citizen
$idNumber2 = RsaIdNumber::generateRsaIdNumber(null, 'f', false);
```

Usage (validation)
------------------

[](#usage-validation)

### Laravel validation rule

[](#laravel-validation-rule)

You can validate incoming request data using the built-in `rsaidnumber` rule:

```
$request->validate([
    'rsaIdNumber' => 'required|string|rsaidnumber',
]);
```

If validation fails, Laravel will return the default message:

```
The rsaIdNumber must be a valid South African ID number.

```

You may customize this message in your localization files under `validation.custom.rsaidnumber`.

### Using the helper class

[](#using-the-helper-class-1)

```
$idNumber = new RsaIdNumber('8208015009088');     # This will also accept ID numbers with spaces
if ($idNumber->isValid()) {
    echo "This ID number is {$idNumber->gender()}";
} else {
    echo 'Invalid ID number';
}
```

Other validation features include:

```
$idNumber->dateOfBirth();
$idNumber->age();
$idNumber->isAdult();
$idNumber->isCitizen();
$idNumber->isPermanentResident();
```

You can also have the ID number formatted for easier reading:

```
$idNumber = new RsaIdNumber('7504220045086');
echo $idNumber->toNatural();     // Echoes as "750422 0045 08 6"
```

License
-------

[](#license)

This library is open-source and available under the [MIT License](LICENSE).

Contributions
-------------

[](#contributions)

Contributions, issues, and feature requests are welcome! Feel free to open a pull request or submit an issue on the repository.

Disclaimer
----------

[](#disclaimer)

This library is for educational and testing purposes only. Do not use the generated ID numbers for illegal or unethical purposes.

About the author
----------------

[](#about-the-author)

[Stuart Steedman](https://www.linkedin.com/in/stuart-steedman/) is the CTO of [Sebenza](https://sebenza.tech), a [DNI company](https://www.dninvest.co.za/), operating out of Bryanston, South Africa. Stuart enjoys [public speaking](https://www.youtube.com/watch?v=S5bjGo7EF5c), and enjoys prototyping complex software in Laravel.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance70

Regular maintenance activity

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~55 days

Recently: every ~83 days

Total

7

Last Release

172d ago

Major Versions

v0.1.2 → v1.0.02024-12-23

v1.0.1 → v2.0.02025-11-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d8b2540548fd4037017a3177a24b230506c67ca96d5ed870cd82153726e597f?d=identicon)[nonsapiens](/maintainers/nonsapiens)

---

Top Contributors

[![stuartsebenza](https://avatars.githubusercontent.com/u/111981335?v=4)](https://github.com/stuartsebenza "stuartsebenza (1 commits)")

### Embed Badge

![Health badge](/badges/yomo-south-african-idnumber-generator/health.svg)

```
[![Health](https://phpackages.com/badges/yomo-south-african-idnumber-generator/health.svg)](https://phpackages.com/packages/yomo-south-african-idnumber-generator)
```

###  Alternatives

[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[pablorsk/argentina-data-generator

Argentina data generator for CUIT and CBU numbers

1323.7k](/packages/pablorsk-argentina-data-generator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
