Getting Started

Modifiers

Modifiers allows you to control output faker data without impacting your code

Modifiers are a way to change the data generated to suit your needs, you are free to add as many as you want

Nullable

Emit the possibility for the data to be null with this modifier (50% by default):

use Xefi\Faker\Faker;

$faker = new Faker();

$faker->nullable()->helloWorld(1, 2); // "Hello World" or null

The unique strategy also gives the possibility to use a weight that correspond to the percentage chance you want the data to be null (O to 100)

use Xefi\Faker\Faker;

$faker = new Faker();

$faker->nullable(0)->helloWorld(1, 2); // "Hello World"
$faker->nullable(100)->helloWorld(1, 2); // null

Lowercase

Put your string in lowercase:

use Xefi\Faker\Faker;

$faker = new Faker();

$faker->lowercase()->sentence(); // my sentence lowercased

Uppercase

Put your string in uppercase:

use Xefi\Faker\Faker;

$faker = new Faker();

$faker->uppercase()->sentence(); // MY SENTENCE UPPERCASED

Copyright © 2024