Download the PHP package phdevutils/core without Composer
On this page you can find all versions of the php package phdevutils/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phdevutils/core
More information about phdevutils/core
Files in phdevutils/core
Package core
Short Description 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).
License MIT
Informations about the package core
phdevutils/core
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.
Install
Requires PHP 8.1+.
Quick start
API Reference
PhDevUtils\Peso
Peso::format(float $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::parse(string $input): ?float
Parse a peso-formatted string back to a float. Strips ₱, PHP, whitespace, and commas. Returns null for unparseable input.
Peso::toWords(float $value): string
Convert to English peso-and-centavos word form. Singular/plural handled.
Peso::toWordsFilipino(float $value): string (v0.3)
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.
Range: sero (0) through trilyon (10^12).
Government ID validators (PhDevUtils\Validators\*)
⚠️ 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
truefor any input with the correct digit count.
Validators\Tin::validate(string $input): bool / Validators\Tin::format(string $input): ?string
BIR TIN: 9 digits (individual) or 12 digits (with branch).
Validators\Sss::validate(string $input): bool / Validators\Sss::format(string $input): ?string
SSS: exactly 10 digits, formatted XX-XXXXXXX-X.
Validators\PhilHealth::validate(string $input): bool / Validators\PhilHealth::format(string $input): ?string
PhilHealth PIN: 12 digits, formatted XX-XXXXXXXXX-X.
Validators\PagIbig::validate(string $input): bool / Validators\PagIbig::format(string $input): ?string
Pag-IBIG MID: 12 digits, formatted XXXX-XXXX-XXXX.
PhDevUtils\Phone
Phone::parseMobile(string $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:
Phone::parseLandline(string $input): ?array
Parse a PH landline with area code lookup.
PhDevUtils\Address
Region and province data follows the Philippine Standard Geographic Code at v0.1 granularity (regions + provinces). Cities, municipalities, and barangays are on the v0.2 roadmap.
Address::listRegions(): array
Returns all 17 PH regions. Each element shape: ['code' => string, 'name' => string, 'designation' => string].
Address::findRegion(string $query): ?array
Look up by code, name, or designation (case-insensitive). Returns null if not found.
Address::listProvinces(?string $regionCode = null): array
Returns all provinces, optionally filtered by region code. Each element shape: ['code' => string, 'name' => string, 'region' => string].
Address::findProvince(string $query): ?array
Look up by code or name (case-insensitive).
Modules table
Direct mapping to the JavaScript sibling package:
| Capability | PHP | JS |
|---|---|---|
| Format 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
MIT