PHP code example of schalkt / faker

1. Go to this page and download the library: Download schalkt/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/ */

    

schalkt / faker example snippets



     use Schalkt\Faker\Faker;

    $faker = Faker::init();

    $faker->fullname(5, 10); // Sutida Ohisovis
    $faker->firstname(7, 7, Faker::FIRST_VOWEL); // Emubefy
    $faker->email(); // [email protected]
    $faker->password(4, 4, 3, '.'); // W2gg.lsgq.FET0
    $faker->word(5); // focix
    $faker->words(5, ', '); // rabija, yigav, bacera, cunay, okzupu
    $faker->words(2, ' | ', 4, 4, Faker::FIRST_CONSONANT, ['zy', 'sy']); // dodosy | rivozy
    $faker->sentence(5); // Uxibawoz witowarehep effemerogola buinaxepugo nuxehow.
    $faker->text(3, 3, 3); // Icolivotuse rebotuk sulageye. Xaco najud quq.
    $faker->int(1, 1000); // 238
    $faker->float(100, 200, 4); // 175.3874
    $faker->boolean(); // true or false    
    $faker->repeat('.', 4, 4, 3, 'oOo'); // ....oOo....oOo....    
    $faker->repeat('#', 3, 3, 4, '-'); // ###-###-###-###
    $faker->repeat('124', 1, 5, 4, ' + '); // 2144 + 24444 + 444 + 22141
    $faker->mask('###-###-###-###', 'ABCDEFG'); // AAE-BAF-DDB-AAF
    $faker->mask('##-##-##-##', '01'); // 11-10-01-10
    $faker->pick(['CEO', 'CTO', 'Founder', 'Director'], 3, ', '); // Director, CEO, CTO
    $faker->date(); // 2001-07-21
    $faker->date('2024-01-01', '2024-12-31', 'Y.m.'); // 2024.02.



     use Schalkt\Faker\Faker;

    $faker = Faker::init([
      'vowels' => 'e',
      'consonants' => 'bhdlmnkpstvz',
      'nextChar' => [
        'sameChar' => 0, // percent between 0-100
        'sameType' => 0, // percent between 0-100
        'double' => 0 // percent between 0-100
      ],
    ]);

    $faker->text(20, 3, 10); // Sedev emeze evekem ez denebebekepep...