The Container#
Container holds definitions - definitions are classes that can be used for generation stuff you need. Each item you can generate has own interface and implementation and you can change if needed.
Available definitions interfaces are in src/Definitions
directory and their implementation is in src/Extensions
.
Each of them can be added to container and passed to DummyGenerator
.
To make it easier there is DefinitionContainerBuilder
that uses DefinitionPack
with 3 predefined definitions packages:
- Base: DateTime, Enum, Lorem, Number, Strings, Uuid
- Default, all from Base plus: Coordinates, Country, Hash, Internet, Language, Person
- All, all from Default plus: Address, Barcode, Biased, Blood, Color, Company, File, Payment, PhoneNumber, UserAgent, Version
Sample usage of DefinitionContainerBuilder
looks like this:
$container = DefinitionContainerBuilder::all(); // to get all extensions
Replacing Strategy or Clock#
You can create DummyGenerator
with given strategy or clock, but you can also change strategy or clock in currently used generator:
$generator = new DummyGenerator(DefinitionContainerBuilder::all(), new SimpleStrategy(), new SystemClock());
$clock = new SystemClock(new \DateTimeZone('UTC'));
$strategy = new UniqueStrategy(retries: 500);
$generator = $generator->withClock($clock)->withStrategy($strategy);