v0.4.5 2023-11-29 19:59 UTC


Packagist Version PHP from Packagist Packagist License
GitHub Workflow Status GitHub Workflow Status codecov
A Faker provider with some random miscellaneous helpers


Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Open a command console, enter your project directory and execute:

$ composer require mrgoodbytes8667/test-common-faker


use Bytes\Common\Faker\Providers\MiscProvider;
use Faker\Factory;

/** @var Factory|MiscProvider $faker */
$faker = Factory::create();
$faker->addProvider(new MiscProvider($faker));

$faker->oneOrMoreOf(['some', 'iterable', 'object']);
$faker->rangeBetween(4, 1, 2);

Note: @var is helpful for IDE autocompletion

With PHPUnit

If you are using $faker in every test, you can use TestFakerTrait to setup/teardown $this->faker before/after each test. Declare $this->providers as an array of additional providers beyond MiscProvider to auto-add them when using this trait.


discord-response-bundle by MrGoodBytes is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
Based on a work at