PHP code example of titipat / faker-php-thai

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

    

titipat / faker-php-thai example snippets


$faker = \Faker\Factory::create('th_TH');
$faker->addProvider(new \Titipat\Faker\Provider\th_TH\Text($faker));

echo $faker->text();

// Your service provider, e.g. App\Providers\AppServiceProvider

use Faker\Generator;

public function boot(): void
{
    $this->app->extend(Generator::class, function (Generator $faker) {
        $faker->addProvider(new \Titipat\Faker\Provider\th_TH\Text($faker));
        return $faker;
    });

    $this->app->bind(
        Generator::class . ":" . config("app.faker_locale", "th_TH"),
        Generator::class,
    );
}

echo fake()->text();

nationalIdNumber(); // 1234567890123

text($maxNbChars = 200); // ดังจะเห็นได้จากศาลเทพเจ้าขนาดใหญ่ที่มีผู้คนจำนวนมากเข้าไปสักการะกราบไหว้ กล่าวโดยสรุป คติความเชื่อเรื่องเทวดาหรือเทพเจ้าในสังคมไทยนี้มีมาแต่ครั้งก่อนสถาปนาอาณาจักรสุโขทัย

composer