https://github.com/telcolab/mykad
A MyKad parser for Malaysian ID Number.
https://github.com/telcolab/mykad
laravel malaysia php
Last synced: 6 months ago
JSON representation
A MyKad parser for Malaysian ID Number.
- Host: GitHub
- URL: https://github.com/telcolab/mykad
- Owner: telcolab
- License: mit
- Created: 2017-04-11T10:23:04.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-31T07:11:49.000Z (about 9 years ago)
- Last Synced: 2025-12-22T22:07:25.198Z (7 months ago)
- Topics: laravel, malaysia, php
- Language: PHP
- Size: 11.7 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://packagist.org/packages/telcolab/mykad) [](https://packagist.org/packages/telcolab/mykad) [](https://packagist.org/packages/telcolab/mykad) [](https://packagist.org/packages/telcolab/mykad)
## MyKad Parser
A package created to split and fetch details in MyKad No.
## Installation
```
composer require telcolab/mykad
```
Open ```config/app.php``` and register in ```providers``` key
```
'providers' => [
...
TelcoLAB\MyKad\MyKadServiceProvider::class,
];
```
and in ```aliases``` key
```
'aliases' => [
...
TelcoLAB\MyKad\Facades\MyKad::class,
];
```
## Usage
Import class.
```
use MyKad;
```
Call parse method.
```
$mykadNo = '970424022345'; //12 digits mykad number.
$mykadNo = '970424-02-2345'; //12 digits mykad number.
$mykadNo = '970424 02 2345'; //12 digits mykad number.
$mykad = MyKad::parse($mykadNo);
```
##### Available properties
```
$mykad->head //970424
$mykad->body //02
$mykad->tail //2345
$mykad->age //19
$mykad->gender //male
$mykad->day //24
$mykad->month //4
$mykad->year //1997
```
##### Available methods
```
$mykad->isOver($age) //true or false
$mykad->isOver18() //true or false
$mykad->isOver12() //true or false
$mykad->isMale() //true or false
$mykad->isFemale() //true or false
```
## License
This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).