xefi/faker-php
xefi/faker-php is a PHP library for generating realistic fake data for tests, fixtures, demos, and database seeding. It provides a simple API for names, addresses, emails, dates, text, and more, with locale-aware data generation.
Random\Randomizer, so a seeded run reproduces. This underpins decisions about CI flake budgets, golden-fixture/snapshot testing, and reliable bug reproduction from a failing build.extra.faker.providers in composer.json. This supports a genuine build decision — one owned fixture package across services instead of copy-pasted helpers.faker_mixin.php gives IDE and coding-agent autocompletion over whatever generators are installed. That supports tooling and onboarding investments, and makes custom generators discoverable without reading source.Adopt-worthy criteria:
Look elsewhere when:
Before committing, run a one-sprint bake-off. Specific behaviors to validate, because they are documented hazards rather than hypotheticals:
forgetExtensions() and forgetBootstrappers() or providers register twice and emit warnings. Confirm this fits your test bootstrap.unique() draws from a process-global pool that is never reset and throws MaximumTriesReached once a bounded set (enum, fixed list, small integer range) is exhausted. Any team reaching for unique() on a bounded set will get a flaky-then-broken suite. Confirm a lint rule or convention can prevent it.E_USER_WARNING with last-registration-wins. Audit your planned extension set for name clashes before you depend on the behavior.For executives: This is a small, Apache-2.0 fake-data generator for PHP tests and database seeding — no license cost, no vendor lock-in. It's worth a pilot because it addresses two costs we already carry: flaky, non-reproducible test data, and an all-or-nothing dependency that bundles locales and features we don't use. Because it's modular, we ship only the locale data for the markets we operate in, and because it's deterministic under a seed, failures reproduce instead of being re-run until green. The honest caveat is maturity: it's a young package with a small community, so the recommendation is a contained pilot in one service, wrapped in our own fixture package so we can revert to the incumbent at low cost. Decision requested: approve a one-sprint evaluation, not a migration.
For engineering: The architecture is deliberately clean and is the main argument for it. A thin Faker entry point builds a fresh container per call, so modifiers and strategies never leak between calls; extensions are plain classes where every public method becomes a Faker method; providers register via a manifest read from extra.faker.providers across installed packages, cached and auto-recompiled. Randomness is injected, not rand()-based, so seeds are honored. A generated docblock mixin gives IDE and agent autocompletion for installed generators. It's framework-agnostic by design — framework code lives in separate bridge packages — and CI runs the suite on PHP 8.3, 8.4 and 8.5 against lowest and highest dependencies. Tests are PHPUnit 12.
For risk reviewers: Dev-only dependency; blast radius is limited to test and seeding tooling. Three documented sharp edges to mitigate up front: the process-global static extension registry, the never-reset unique() pool, and global method-name collisions across extensions. All three are containable with our own fixture wrapper package and a short internal usage note — and that wrapper is also our exit ramp.
How can I help you explore Laravel packages today?