PHPackages                             fikrimastor/mykad - 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. fikrimastor/mykad

ActiveLibrary

fikrimastor/mykad
=================

Mykad package is a laravel package, purposely to validate, parse, and format Malaysian Identity Card (MyKad) numbers.

v1.1.0(1y ago)02.6k[2 PRs](https://github.com/fikrimastor/mykad/pulls)MITPHPPHP ^8.1CI passing

Since May 18Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/fikrimastor/mykad)[ Packagist](https://packagist.org/packages/fikrimastor/mykad)[ Docs](https://github.com/fikrimastor/mykad)[ GitHub Sponsors](https://github.com/FikriMastor)[ RSS](/packages/fikrimastor-mykad/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (12)Versions (13)Used By (0)

Validate MyKad with Laravel
===========================

[](#validate-mykad-with-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/754871ca56168627b9d0c305c958b740f9905cd93173ed6182de4c68c0c665fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66696b72696d6173746f722f6d796b61642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fikrimastor/mykad)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d6117e3bff2ca40d777136ff8e6ddeeaaa678df6f15a00f9b049e130fa576d87/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f66696b72696d6173746f722f6d796b61642f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/fikrimastor/mykad/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/a34873f5fa39e039c9a3b33e0ba5b86a2e12e1b6151860a8a3a23d12f1919180/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f66696b72696d6173746f722f6d796b61642f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/fikrimastor/mykad/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/566a8cf92024664fc5607481bfc2e25b18d7922bbfaa2e0ca8254429238d78f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66696b72696d6173746f722f6d796b61642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fikrimastor/mykad)

MyKad is a laravel package, purposely to validate, parse, extract and format Malaysian Identity Card (MyKad) numbers.

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

[](#installation)

You can install the package via composer:

```
composer require fikrimastor/mykad
```

Optionally, you can publish the config file with:

```
php artisan vendor:publish --tag="mykad-config"
```

This is the contents of the published config file:

```
return [
    'states-code' => [
        // Source: https://www.jpn.gov.my/my/kod-negeri

        // Johor
        '01' => 'Johor',
        '21' => 'Johor',
        '22' => 'Johor',
        '23' => 'Johor',
        '24' => 'Johor',

        // Kedah
        '02' => 'Kedah',
        '25' => 'Kedah',
        '26' => 'Kedah',
        '27' => 'Kedah',

        ...
        ...
        ...

        // Negeri Tidak Diketahui
        '82' => 'Unknown',
    ],
];
```

Usage
-----

[](#usage)

```
use FikriMastor\MyKad\Facades\MyKad;

echo MyKad::sanitize('010101-01-0101'); // '010101010101'

echo MyKad::extract('010101010101');
//[
//  "date_of_birth" => "1 January 2001"
//  "state" => "Johor"
//  "gender" => "Male"
//]
```

You can also use the validator to validate the MyKad number.

```
use FikriMastor\MyKad\Rules\IsMyKad;

$request->validate([
    'mykad' => ['required', 'string', new IsMyKad],
]);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Fikri Mastor](https://github.com/fikrimastor)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance68

Regular maintenance activity

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.2% 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 ~27 days

Recently: every ~53 days

Total

9

Last Release

509d ago

Major Versions

0.04 → v1.0.02024-05-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/05693f8257a9a2b5b2f3c472c911aa2ff902a6d37c053320999ddc17e457d729?d=identicon)[fikrimastor](/maintainers/fikrimastor)

---

Top Contributors

[![fikrimastor](https://avatars.githubusercontent.com/u/18373448?v=4)](https://github.com/fikrimastor "fikrimastor (69 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

laravel-packagemalaysian-mykadmalaysian-nricmykadlaravellaravel-packageMyKadFikriMastor

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/fikrimastor-mykad/health.svg)

```
[![Health](https://phpackages.com/badges/fikrimastor-mykad/health.svg)](https://phpackages.com/packages/fikrimastor-mykad)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)[sunchayn/nimbus

A Laravel package providing an in-browser API client with automatic schema generation, live validation, and built-in authentication with a touch of Laravel-tailored magic for effortless API testing.

29428.0k](/packages/sunchayn-nimbus)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

15828.6k](/packages/relaticle-custom-fields)[yoeriboven/laravel-log-db

A database driver for logging with Laravel

58156.5k](/packages/yoeriboven-laravel-log-db)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

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