Download the PHP package hariadi/siapa without Composer
On this page you can find all versions of the php package hariadi/siapa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hariadi/siapa
More information about hariadi/siapa
Files in hariadi/siapa
Informations about the package siapa
Siapa 
Malay Name Parser: A simple script for parsing complex Malay names into their individual components.
- Salutation
- First Name
- Last Name
- Gender
Example Usage
Install
If you're using Composer to manage dependencies, you can include the following in your composer.json file:
`composer require hariadi/siapa`
Then, after running composer update
or php composer.phar update
, you can
load the class using Composer's autoloading:
Otherwise, you can simply require the file directly:
OO and Procedural
The library offers both OO method chaining with Hariadi\Siapa
. An example
of the former is the following:
Methods
Note: If $encoding
is not given, it defaults to mb_internal_encoding()
.
salutation
$siapa->salutation()
Siapa::salutation()
Returns salutation from full name.
givenName
Siapa::givenName()
Returns the combine of first and last name without salutation and optional with or witout middle name.
first
Siapa::first()
Returns the first name.
last
Siapa::last()
Returns the last name.
gender
Siapa::gender(boolean $short)
Returns the gender of name. Default param is true
for short gender (M for Male and F for Female).
Algorithm to detect malay name gender:
- Default gender is Male
- Check if
Binti
,Bte.
,Bte
,Puan
,Puan
,Pn.
,Bt.
,Bt
,A/P
exist in first name - If not found then we check for salutation if
Hajah
,Hajjah
,Hjh.
,Puan
,Pn.
,Cik
exist. - If not found then we check for common female malay name in
female.txt
library
Tests
- Clone the repository: git clone https://github.com/hariadi/Siapa.git
- From the project directory, tests can be ran using
phpunit
License
Released under the MIT License - see LICENSE.txt
for details.