sempurnama/gemilang

Comprehensive Malaysian data and formatting utilities for Laravel

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/sempurnama/gemilang

dev-main 2025-12-13 08:04 UTC

This package is auto-updated.

Last update: 2025-12-13 17:05:52 UTC


README

Gemilang is a comprehensive Laravel package for Malaysian geographical data and formatting utilities. It provides accurate lists of States, Districts (Cities/Towns), and Postcodes, sourced from community-maintained datasets, along with helpers for Malaysian specific formatting.

Features

  • Geographical Data:
    • States (Negeri): Complete list of 13 states + 3 Federal Territories.
    • Districts (Daerah): Extensive list of districts/cities mapped to states.
    • Postcodes (Poskod): Over 2,900+ postcodes mapped to their respective areas.
  • Formatting Helpers:
    • Address: Standardize Malaysian addresses.
    • Phone: Format numbers to +60 format.
    • Currency: RM formatting.
  • Car Brands: List of Malaysian automotive manufacturers.

Installation

composer require sempurnama/gemilang

Usage

Locality Data

use Gemilang\Facades\Gemilang;

// Get all states
$states = Gemilang::negeri();

// Get districts in a state (pass state ID/code)
$johorDistricts = Gemilang::daerah('johor');

// Get all postcodes or filter by district
$postcodes = Gemilang::poskod();
$muarPostcodes = Gemilang::poskod('johor_muar');

NRIC & JPN

Format NRIC

echo Gemilang::formatNric('900101011234'); // 900101-01-1234

Get Birth State from NRIC

$state = Gemilang::getJpnState('900101011234');
echo $state['name']; // Johor

Political Divisions

// Get all Parliament constituencies
$allParlimens = Gemilang::parlimens();

// Get Parliament constituencies for a specific state
$johorParlimens = Gemilang::parlimens('johor'); // Returns Collection

// Get all DUNs
$allDuns = Gemilang::duns();

// Get DUNs for a specific state
$johorDuns = Gemilang::duns('johor');

Identification (State Detection)

From NRIC

$state = Gemilang::getJpnState('900101011234');

From Vehicle Plate

$state = Gemilang::getPlateState('W1234'); // Returns KL
$state = Gemilang::getPlateState('J1234'); // Returns Johor

From Landline Phone

$state = Gemilang::getPhoneState('07-1234567'); // Returns Johor (07)

Locations (Aliases)

// Standard English aliases
$states = Gemilang::states();
$districts = Gemilang::districts('johor');
$postcodes = Gemilang::postcodes();

// Search cities/districts
$tamans = Gemilang::tamans(); // Returns districts with 'Taman' in name
$kampungs = Gemilang::kampungs(); // Returns districts with 'Kampung' in name

Formatting

Phone Number

echo Gemilang::formatTelefon('012-3456789'); // +60 123456789

Currency

echo Gemilang::formatMatawang(1250.50); // RM 1,250.50

Address

$address = Gemilang::formatAlamat([
    'unit' => 'No 15',
    'street' => 'Jalan Tun Razak',
    'area' => 'Kampung Baru',
    'city' => 'Kuala Lumpur',
    'postcode' => '50400',
    'state' => 'Wp Kuala Lumpur'
]);

// Output:
// No 15
// Jalan Tun Razak
// Kampung Baru
// 50400 KUALA LUMPUR
// WP KUALA LUMPUR

Data Sources

License

MIT