Download the PHP package akukoder/mykad without Composer
On this page you can find all versions of the php package akukoder/mykad. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download akukoder/mykad
More information about akukoder/mykad
Files in akukoder/mykad
Package mykad
Short Description A package to deal with MyKad or MyKid format, including validation and Faker provider.
License MIT
Homepage https://akukoder.com
Informations about the package mykad
MyKad
Extract information from MyKad/MyKid number, validate the input from user and generate Faker data.
About MyKad
The Government Multi-Purpose Smart Card Project (MPSC) or MyKad is part of the Multimedia Super Corridor (MSC Malaysia) initiative.
Introduction
This package provides:
- Data extraction
- Input validation
- Faker Provider to generate fake MyKad number (for Laravel)
Installation
You can install the package via composer:
Data Extraction
With this package, your can extract some information from the MyKad/MyKid:
- Date of Birth
- State name
- Gender
Date of birth
Get date of birth from the input.
Gender
Get gender from the input. Basically, 1 for male and 0 for female.
State
Get state name from the input.
Validation
One of the most annoying thing when dealing with user records is when they entered wrong MyKad/MyKid number. This package helps reduce the burden to deal with invalid input by users.
This package will validate MyKad/MyKid number to make sure:
- Contains numbers only
- Valid length
- Valid date of birth
- Valid state/country code
Note:
Any other unnecessary characters from the input will be removed, including dashes.
Usage
Get exception on errors
Faker Provider
To generate dummy data for your test or model factory, add these to on of your service provider or create new one. Let's create a new service provider:
Register MyKadProvider in register method.
Make sure to include the additional Laravel service provider in the file.
Now you can use the new formatter like the other Faker formatters. In a Laravel factory, the syntax for the custom formatter looks like this:
Testing
Credits
- https://www.jpn.gov.my/en/faq/faq-identity-card
- https://hofmannsven.com/2021/faker-provider-in-laravel
License
The MIT License (MIT).