PHPackages                             phdevutils/core - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. phdevutils/core

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

phdevutils/core
===============

Filipino developer utilities — peso (incl. Tagalog number-words), government IDs (TIN/SSS/PhilHealth/Pag-IBIG/PhilSys National ID/UMID/passport/PRC), phone (parse + E.164 normalize), address (regions/provinces/cities/municipalities), and PH holidays (regular + special, with DOLE pay multipliers).

v0.5.0(1w ago)027↓50%3MITPHPPHP &gt;=8.1

Since May 19Pushed 1w agoCompare

[ Source](https://github.com/kon2raya24/ph-dev-utils-php)[ Packagist](https://packagist.org/packages/phdevutils/core)[ RSS](/packages/phdevutils-core/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (9)Used By (3)

phdevutils/core
===============

[](#phdevutilscore)

[![Packagist version](https://camo.githubusercontent.com/18c16a86d6fe8f3ac6c7fae92db52892d0e42845d57315761b1d6404613a7ac4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70686465767574696c732f636f72653f6c6162656c3d5061636b616769737426636f6c6f723d663238643161266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/phdevutils/core)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/kon2raya24/ph-dev-utils/blob/main/LICENSE)[![Made in PH](https://camo.githubusercontent.com/e9d62429053ae0e0e8db5071df8eaba9a45ad7f91130696a66262598b44094e5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d616465253230696e2d2546302539462538372542352546302539462538372541442532305068696c697070696e65732d303033384138)](https://github.com/kon2raya24)

Filipino developer utilities for PHP — peso formatting, government ID validators (TIN / SSS / PhilHealth / Pag-IBIG), PH phone parsing with network detection, and PSGC region / province lookup.

Need fake test data on top of this? See the sibling [`phdevutils/faker`](https://packagist.org/packages/phdevutils/faker).

Install
-------

[](#install)

```
composer require phdevutils/core
```

Requires PHP 8.1+.

Quick start
-----------

[](#quick-start)

```
use PhDevUtils\Peso;
use PhDevUtils\Validators\Tin;
use PhDevUtils\Phone;
use PhDevUtils\Address;

Peso::format(1234.5);                       // '₱1,234.50'
Peso::parse('₱1,234.50');                   // 1234.5
Tin::validate('123-456-789-000');           // true
Phone::parseMobile('09171234567');          // ['network' => 'Globe', 'e164' => '+639171234567', ...]
Address::findProvince('Cebu');              // ['code' => '0722', 'name' => 'Cebu', 'region' => '07']
```

API Reference
-------------

[](#api-reference)

### `PhDevUtils\Peso`

[](#phdevutilspeso)

#### `Peso::format(float $value, array $opts = []): string`

[](#pesoformatfloat-value-array-opts---string)

Format a number as a peso amount with thousands separators.

Options array shape: `['decimals' => int, 'symbol' => 'peso'|'php'|'none']`. Defaults: `decimals: 2`, `symbol: 'peso'`.

```
Peso::format(1234.5);                            // '₱1,234.50'
Peso::format(1234.5, ['decimals' => 0]);         // '₱1,235'
Peso::format(1234.5, ['symbol' => 'php']);       // 'PHP 1,234.50'
Peso::format(1234.5, ['symbol' => 'none']);      // '1,234.50'
Peso::format(-50.0);                             // '-₱50.00'
```

#### `Peso::parse(string $input): ?float`

[](#pesoparsestring-input-float)

Parse a peso-formatted string back to a float. Strips `₱`, `PHP`, whitespace, and commas. Returns `null` for unparseable input.

```
Peso::parse('₱1,234.50');     // 1234.5
Peso::parse('PHP 50');        // 50.0
Peso::parse('-1,000');        // -1000.0
Peso::parse('not a number');  // null
```

#### `Peso::toWords(float $value): string`

[](#pesotowordsfloat-value-string)

Convert to English peso-and-centavos word form. Singular/plural handled.

```
Peso::toWords(1);             // 'one peso'
Peso::toWords(1234);          // 'one thousand two hundred thirty-four pesos'
Peso::toWords(1234.56);       // 'one thousand two hundred thirty-four pesos and fifty-six centavos'
Peso::toWords(-50);           // 'negative fifty pesos'
```

#### `Peso::toWordsFilipino(float $value): string` (v0.3)

[](#pesotowordsfilipinofloat-value-string-v03)

Convert to **Filipino (Tagalog)** peso-and-centavos word form, using the check/receipt convention `[whole-words] at [XX]/100 piso`. Handles ligature rules and the `daan`/`raan` initial-consonant alternation.

```
Peso::toWordsFilipino(1);            // 'Isang piso'
Peso::toWordsFilipino(100);          // 'Isang daang piso'
Peso::toWordsFilipino(400);          // 'Apat na raang piso'
Peso::toWordsFilipino(1000);         // 'Isang libong piso'
Peso::toWordsFilipino(1_000_000);    // 'Isang milyong piso'
Peso::toWordsFilipino(12345.67);     // "Labindalawang libo tatlong daan apatnapu't lima at 67/100 piso"
Peso::toWordsFilipino(0);            // 'Sero piso'
Peso::toWordsFilipino(0.5);          // 'Sero at 50/100 piso'
Peso::toWordsFilipino(-1);           // throws OutOfRangeException
```

Range: `sero` (0) through `trilyon` (10^12).

---

### Government ID validators (`PhDevUtils\Validators\*`)

[](#government-id-validators-phdevutilsvalidators)

> ⚠️ All validators are **format-level only**. SSS / PhilHealth / Pag-IBIG do not publish official checksum algorithms; unofficial implementations produce confident-but-wrong results in production. This package returns `true` for any input with the correct digit count.

#### `Validators\Tin::validate(string $input): bool` / `Validators\Tin::format(string $input): ?string`

[](#validatorstinvalidatestring-input-bool--validatorstinformatstring-input-string)

BIR TIN: 9 digits (individual) or 12 digits (with branch).

```
use PhDevUtils\Validators\Tin;

Tin::validate('123-456-789');         // true
Tin::validate('123-456-789-000');     // true
Tin::validate('123');                 // false

Tin::format('123456789');             // '123-456-789'
Tin::format('123456789000');          // '123-456-789-000'
Tin::format('123');                   // null
```

#### `Validators\Sss::validate(string $input): bool` / `Validators\Sss::format(string $input): ?string`

[](#validatorssssvalidatestring-input-bool--validatorssssformatstring-input-string)

SSS: exactly 10 digits, formatted `XX-XXXXXXX-X`.

```
use PhDevUtils\Validators\Sss;

Sss::validate('12-3456789-0');   // true
Sss::format('1234567890');       // '12-3456789-0'
```

#### `Validators\PhilHealth::validate(string $input): bool` / `Validators\PhilHealth::format(string $input): ?string`

[](#validatorsphilhealthvalidatestring-input-bool--validatorsphilhealthformatstring-input-string)

PhilHealth PIN: 12 digits, formatted `XX-XXXXXXXXX-X`.

```
use PhDevUtils\Validators\PhilHealth;

PhilHealth::validate('123456789012');   // true
PhilHealth::format('123456789012');     // '12-345678901-2'
```

#### `Validators\PagIbig::validate(string $input): bool` / `Validators\PagIbig::format(string $input): ?string`

[](#validatorspagibigvalidatestring-input-bool--validatorspagibigformatstring-input-string)

Pag-IBIG MID: 12 digits, formatted `XXXX-XXXX-XXXX`.

```
use PhDevUtils\Validators\PagIbig;

PagIbig::validate('123456789012');   // true
PagIbig::format('123456789012');     // '1234-5678-9012'
```

---

### `PhDevUtils\Phone`

[](#phdevutilsphone)

#### `Phone::parseMobile(string $input): ?array`

[](#phoneparsemobilestring-input-array)

Parse a PH mobile number with network detection. Accepts `+63...`, `63...`, `09...`, and `9...` forms. Returns `null` if it doesn't normalize to an 11-digit PH mobile.

Return shape:

```
[
  'e164'     => '+63XXXXXXXXXX',
  'national' => '0XXXXXXXXXX',
  'network'  => 'Globe' | 'Smart' | 'Sun' | 'DITO' | null,
]
```

```
Phone::parseMobile('09171234567');
// ['e164' => '+639171234567', 'national' => '09171234567', 'network' => 'Globe']

Phone::parseMobile('+639951234567');
// ['e164' => '+639951234567', 'national' => '09951234567', 'network' => 'DITO']

Phone::parseMobile('not a phone');   // null
```

#### `Phone::parseLandline(string $input): ?array`

[](#phoneparselandlinestring-input-array)

Parse a PH landline with area code lookup.

```
[
  'e164'     => '+63XXXXXXXXXX',
  'national' => '(0X) XXX-XXXX' | '(0XX) XXX-XXXX',
  'areaCode' => '2' | '32' | '74' | ...,
  'area'     => 'Metro Manila' | 'Cebu' | ... | null,
]
```

```
Phone::parseLandline('(02) 8123-4567');
// ['areaCode' => '2', 'area' => 'Metro Manila', ...]

Phone::parseLandline('322345678');
// ['areaCode' => '32', 'area' => 'Cebu', 'national' => '(032) 234-5678', ...]
```

---

### `PhDevUtils\Address`

[](#phdevutilsaddress)

Region and province data follows the [Philippine Standard Geographic Code](https://psa.gov.ph/classification/psgc) at v0.1 granularity (regions + provinces). Cities, municipalities, and barangays are on the v0.2 roadmap.

#### `Address::listRegions(): array`

[](#addresslistregions-array)

Returns all 17 PH regions. Each element shape: `['code' => string, 'name' => string, 'designation' => string]`.

```
count(Address::listRegions());   // 17
Address::listRegions()[0];
// ['code' => '01', 'name' => 'Ilocos Region', 'designation' => 'Region I']
```

#### `Address::findRegion(string $query): ?array`

[](#addressfindregionstring-query-array)

Look up by code, name, or designation (case-insensitive). Returns `null` if not found.

```
Address::findRegion('NCR');                       // ['code' => '13', 'name' => 'National Capital Region', ...]
Address::findRegion('04');                        // ['code' => '04', 'name' => 'CALABARZON', ...]
Address::findRegion('calabarzon');                // same (case-insensitive)
Address::findRegion('Atlantis');                  // null
```

#### `Address::listProvinces(?string $regionCode = null): array`

[](#addresslistprovincesstring-regioncode--null-array)

Returns all provinces, optionally filtered by region code. Each element shape: `['code' => string, 'name' => string, 'region' => string]`.

```
count(Address::listProvinces());           // ~80
count(Address::listProvinces('04'));       // CALABARZON only
Address::listProvinces('04')[0];           // ['code' => '0420', 'name' => 'Batangas', 'region' => '04']
```

#### `Address::findProvince(string $query): ?array`

[](#addressfindprovincestring-query-array)

Look up by code or name (case-insensitive).

```
Address::findProvince('Cebu');     // ['code' => '0722', 'name' => 'Cebu', 'region' => '07']
Address::findProvince('0722');     // same
Address::findProvince('Atlantis'); // null
```

---

Modules table
-------------

[](#modules-table)

Direct mapping to the JavaScript sibling package:

CapabilityPHPJSFormat peso`Peso::format($n)``formatPHP(n)`Parse peso`Peso::parse($s)``parsePHP(s)`Peso to words (English)`Peso::toWords($n)``pesoToWords(n)`Peso to words (Filipino)`Peso::toWordsFilipino($n)``pesoToWordsFilipino(n)`Validate TIN`Validators\Tin::validate($s)``validateTIN(s)`Validate SSS`Validators\Sss::validate($s)``validateSSS(s)`Validate PhilHealth`Validators\PhilHealth::validate($s)``validatePhilHealth(s)`Validate Pag-IBIG`Validators\PagIbig::validate($s)``validatePagIBIG(s)`Parse mobile`Phone::parseMobile($s)``parseMobile(s)`Parse landline`Phone::parseLandline($s)``parseLandline(s)`List regions`Address::listRegions()``listRegions()`Find region`Address::findRegion($q)``findRegion(q)`List provinces`Address::listProvinces($code = null)``listProvinces(code?)`Find province`Address::findProvince($q)``findProvince(q)`License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance98

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 80% 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 ~1 days

Total

8

Last Release

12d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ea8892a6c7ba804d12cac27e5927f4b7695d3fc63fec0ecd512d07c117246d6a?d=identicon)[kon2raya24](/maintainers/kon2raya24)

---

Top Contributors

[![kon2raya24](https://avatars.githubusercontent.com/u/167972097?v=4)](https://github.com/kon2raya24 "kon2raya24 (8 commits)")[![Kon2raya](https://avatars.githubusercontent.com/u/116622599?v=4)](https://github.com/Kon2raya "Kon2raya (2 commits)")

---

Tags

filipinopackagistphilippinesphpvalidationpassportholidaysphilippinestinnational idpesopsgcfilipinosssphilhealthpagibiglabor-daydolephilsysumidprc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phdevutils-core/health.svg)

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

###  Alternatives

[reducktion/socrates

A package to validate, and extract citizen information from, national identification numbers.

478.8k](/packages/reducktion-socrates)[ziming/laravel-zxcvbn

Zxcvbn Password validation rule for Laravel

3064.3k](/packages/ziming-laravel-zxcvbn)

PHPackages © 2026

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