PHPackages                             my-gov/myssm - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. my-gov/myssm

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

my-gov/myssm
============

A parser and validate Malaysian business registration numbers (BRN). This library ensures compliance with SSM formatting standards, accurately extracts components such as entity type and registration year, and verifies the integrity of BRNs.

1.0.6(1y ago)0170MITPHPPHP &gt;=8.2

Since Jul 28Pushed 1y ago2 watchersCompare

[ Source](https://github.com/sim-soft/mygov-myssm)[ Packagist](https://packagist.org/packages/my-gov/myssm)[ RSS](/packages/my-gov-myssm/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (9)Used By (0)

MySSM Business Registration Number (BRN) Parser
===============================================

[](#myssm-business-registration-number-brn-parser)

A simple MySSM business registration number and validator.

Install
-------

[](#install)

```
composer require my-gov/myssm
```

Basic Usage
-----------

[](#basic-usage)

Use MySSM BRN parser to retrieve basic information from a given business registration number.

```
require 'vendor/autoload.php';

use MyGOV\MySSM\BRN;
use MyGOV\MySSM\Exceptions\ParseBRNException;
use MyGOV\MySSM\Exceptions\InvalidBRNException;
use MyGOV\MySSM\Exceptions\InvalidBRNFormatException;
use MyGOV\MySSM\Format\Enums\EntityCode;
use Throwable;

try {
    $brn = BRN::parse('201901000005 (1312525-A)');
    if ($brn->isValid()) {
        echo $brn;                                      // 201901000005 (1312525-A)
        echo $brn->format2019;                          // 201901000005
        echo $brn->format2019->isValid();               // true
        echo $brn->format2019->getYear();               // 2019
        echo $brn->format2019->getEntityCode();         // 01
        echo $brn->format2019->getEntityTypeName();     // Local Companies
        echo $brn->format2019->getSequenceNumber();     // 000005
        echo $brn->format2019->is(EntityCode::Business);// false

        echo $brn->classic;                             // 1312525-A
        echo $brn->classic->isValid();                  // true
        echo $brn->classic->getSequenceNumber();        // 1312525
        echo $brn->classic->getCheckDigit();            // A
        echo $brn->classic->is(EntityCode::Business);   // false
    }

    $brn = BRN::parse('SA0173178-P/ 202003000005');
    if ($brn->isValid()) {
        echo $brn;                                      // 202003000005 (SA0173178-P)
        echo $brn->format2019;                          // 202003000005
        echo $brn->format2019->isValid();               // true
        echo $brn->format2019->getYear();               // 2020
        echo $brn->format2019->getEntityCode();         // 03
        echo $brn->format2019->getEntityTypeName();     // Business (ROB)
        echo $brn->format2019->getSequenceNumber();     // 000005
        echo $brn->format2019->is(EntityCode::Business);// true

        echo $brn->classic;                             // SA0173178-P
        echo $brn->classic->isValid();                  // true
        echo $brn->classic->getSequenceNumber();        // SA0173178
        echo $brn->classic->getCheckDigit();            // P
        echo $brn->classic->is(EntityCode::Business);   // true
    }

    $brn = BRN::parse('SA0173178-P');
    if ($brn->isValid()) {
        echo $brn;                                      // SA0173178-P
        echo $brn->format2019;                          // null
        echo $brn->format2019->isValid();               // false
        echo $brn->format2019->getYear();               // null
        echo $brn->format2019->getEntityCode();         // null
        echo $brn->format2019->getEntityTypeName();     // null
        echo $brn->format2019->getSequenceNumber();     // null
        echo $brn->format2019->is(EntityCode::Business);// false

        echo $brn->classic;                             // SA0173178-P
        echo $brn->classic->isValid();                  // true
        echo $brn->classic->getSequenceNumber();        // SA0173178
        echo $brn->classic->getCheckDigit();            // P
        echo $brn->classic->is(EntityCode::Business);   // true
    }

    $brn = BRN::parse('3178-Q');
    if ($brn->isValid()) {
        echo $brn;                                          // 0003178-Q
        echo $brn->format2019;                              // null
        echo $brn->format2019->isValid();                   // false
        echo $brn->format2019->getYear();                   // null
        echo $brn->format2019->getEntityCode();             // null
        echo $brn->format2019->getEntityTypeName();         // null
        echo $brn->format2019->getSequenceNumber();         // null
        echo $brn->format2019->is(EntityCode::Business);    // false

        echo $brn->classic;                                         // 3178-P
        echo $brn->classic->isValid();                              // true
        echo $brn->classic->leadingZeros();                         // 0003178-P
        echo $brn->classic->getSequenceNumber();                    // 3178
        echo $brn->classic->leadingZeros()->getSequenceNumber();    // 0003178  show leading zeros.
        echo $brn->classic->getCheckDigit();                        // P
        echo $brn->classic->is(EntityCode::Business);               // false
    }
} catch (Throwable $throwable) {
    echo $throwable->getMessage();
}
```

Turn On the Exceptions
----------------------

[](#turn-on-the-exceptions)

Set `exception` to **true** for enable `Exceptions`

```
require 'vendor/autoload.php';

use MyGOV\MySSM\BRN;

try {
    $brn = BRN::parse('201901003209 (000184266S)', exception: true);

    if ($brn->isValid()) {
        echo $brn->classic->getSequenceNumber();   // 000184266
        echo $brn->classic->getCheckDigit();       // S
    } else {
        echo $brn->classic->getSequenceNumber();   // null
        echo $brn->classic->getCheckDigit();       // null
    }
} catch (ParseBRNException | InvalidBRNException | InvalidBRNFormatException | Throwable $throwable) {
    echo $throwable->getMessage();
}
```

Business Registration Number (BRN) Generator
--------------------------------------------

[](#business-registration-number-brn-generator)

Generate a random business registration number.

```
require 'vendor/autoload.php';

use MyGOV\MySSM\Exceptions\GenerateBRNException;
use MyGOV\MySSM\Format\Enums\EntityCode;
use MyGOV\MySSM\BRN;

try {
    $brn = BRN::make();
    if ($brn->isValid()) {
        echo $brn;                                      // 202003000005 (SA0173178-P)
        echo $brn->format2019;                          // 202003000005
        echo $brn->format2019->isValid();               // true
        echo $brn->format2019->getYear();               // 2020
        echo $brn->format2019->getEntityCode();         // 03
        echo $brn->format2019->getEntityTypeName();     // Business (ROB)
        echo $brn->format2019->getSequenceNumber();     // 000005
        echo $brn->format2019->is(EntityCode::Business);// true

        echo $brn->classic;                             // SA0173178-P
        echo $brn->classic->isValid();                  // true
        echo $brn->classic->getSequenceNumber();        // SA0173178
        echo $brn->classic->getCheckDigit();            // P
        echo $brn->classic->is(EntityCode::Business);   // true
    }
} catch(GenerateBRNException | Throwable Throwable) {
    echo $throwable->getMessage();
}
```

Generate a BRN with year of registration.

```
$brn = BRN::make(year: 2010);
if ($brn->isValid()) {
    echo $brn;                                      // 201001000005 (SA0173178-P)
    echo $brn->format2019;                          // 201001000005
    echo $brn->format2019->isValid();               // true
    echo $brn->format2019->getYear();               // 2010
    echo $brn->format2019->getEntityCode();         // 01
    echo $brn->format2019->getEntityTypeName();     // Local Companies
    echo $brn->format2019->getSequenceNumber();     // 000005
    echo $brn->format2019->is(EntityCode::Business);// false

    echo $brn->classic;                             // SA0173178-P
    echo $brn->classic->isValid();                  // true
    echo $brn->classic->getSequenceNumber();        // SA0173178
    echo $brn->classic->getCheckDigit();            // P
    echo $brn->classic->is(EntityCode::Business);   // false
}
```

Generate a ROB BRN.

```
$brn = BRN::make(entityCode: EntityCode::Business);
if ($brn->isValid()) {
    echo $brn;                                      // 199003000005 (SA0173178-P)
    echo $brn->format2019;                          // 199003000005
    echo $brn->format2019->isValid();               // true
    echo $brn->format2019->getYear();               // 1990
    echo $brn->format2019->getEntityCode();         // 03
    echo $brn->format2019->getEntityTypeName();     // Business (ROB)
    echo $brn->format2019->getSequenceNumber();     // 000005
    echo $brn->format2019->is(EntityCode::Business);// true

    echo $brn->classic;                             // SA0173178-P
    echo $brn->classic->isValid();                  // true
    echo $brn->classic->getSequenceNumber();        // SA0173178
    echo $brn->classic->getCheckDigit();            // P
    echo $brn->classic->is(EntityCode::Business);   // true
}
```

License
-------

[](#license)

The Simsoft MyGOV/MySSM is licensed under the MIT License. See the [LICENSE](LICENSE) file for details

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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 ~2 days

Total

7

Last Release

693d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c3e6315469b56ed1797318e31e05bcddb12dba268488a2fb0cd2b43971c9ac3?d=identicon)[vzangloo](/maintainers/vzangloo)

---

Top Contributors

[![vzangloo](https://avatars.githubusercontent.com/u/1908200?v=4)](https://github.com/vzangloo "vzangloo (8 commits)")

---

Tags

myssmsuruhanjaya syarikat malaysiabusiness registration numberbrn

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/my-gov-myssm/health.svg)

```
[![Health](https://phpackages.com/badges/my-gov-myssm/health.svg)](https://phpackages.com/packages/my-gov-myssm)
```

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19139.2M45](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9843.5k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

45153.1k6](/packages/jstewmc-rtf)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.2k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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