PHP code example of phdevutils / faker

1. Go to this page and download the library: Download phdevutils/faker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

phdevutils / faker example snippets


use PhDevUtils\Faker\Faker;

$f = new Faker(seed: 42);

$f->name->full();              // 'Maria Santos'
$f->address->full();           // '123 Rizal St., Cavite, CALABARZON'
$f->phone->mobile();           // '+639171234567'
$f->id->tin();                 // '123-456-789-000'
$f->business->name();          // 'Aling Nena Sari-Sari Store'

$f1 = new Faker();         // default seed
$f2 = new Faker(seed: 42); // custom seed → reproducible

$f = new Faker(1);
$f->name->full();   // 'Cristina Cruz'
$f->seed(1);
$f->name->full();   // 'Cristina Cruz' (same — sequence reset)

$f->name->first();           // 'Maria'
$f->name->first('male');     // 'Juan'
$f->name->first('female');   // 'Liza'

$f->name->last();   // 'Reyes'

$f->name->full();           // 'Maria Santos'
$f->name->full('male');     // 'Carlos Mendoza'

$f->name->fullWithMiddle();   // 'Maria Reyes Santos'

$f->address->region();
// ['code' => '04', 'name' => 'CALABARZON', 'designation' => 'Region IV-A']

$f->address->province();
// ['code' => '0434', 'name' => 'Cavite', 'region' => '04']

$f->address->street();   // '8090 Burgos Avenue'

$f->address->full();
// '8090 Burgos Avenue, La Union, Ilocos Region'

$f->phone->mobile();   // '+639171234567'

$f->phone->mobileByNetwork('Globe');   // '+639170123456'
$f->phone->mobileByNetwork('DITO');    // '+639950987654'

$f->phone->landline();   // '(02) 8123-4567'
$f->phone->landline();   // '(32) 234-5678'

$f->id->tin();        // '123-456-789-000'
$f->id->tin(true);    // '123-456-789-456' (with branch)
$f->id->tin(false);   // '123-456-789'     (individual, no branch)

$f->id->sss();   // '12-3456789-0'

$f->id->philhealth();   // '12-345678901-2'

$f->id->pagibig();   // '1234-5678-9012'

$f->id->nationalID();   // '1234-5678-9012-3456'

$f->id->umid();   // '1234-5678901-2'

$f->id->passport();   // 'P1234567A'

$f->id->prc();   // '1234567'

$f->money->peso();              // 4218.73
$f->money->peso(100, 500);      // 387.21

$f->money->salary();   // 42158.50

$f->money->price();   // 87.25

$f->business->name();   // 'Aling Nena Sari-Sari Store'
$f->business->name();   // 'RJ Enterprises'
$f->business->name();   // 'Tindahan ni Reyes'