butschster/entity-faker
Generate fake PHP entities and persist them via your ORM using a simple factory. Define per-class attribute generators with Faker, support inheritance via raw attributes, and create single or multiple entities using Laminas hydrators/entity factories.
butschster/entity-faker) remains aligned with Laravel’s testing, seeding, and development workflows, but v2.0.0’s redesign of EntityFactory introduces architectural shifts that may require reevaluation. The core value proposition—abstracting fake entity generation—persists, but the new design may simplify or complicate adoption depending on how it handles relationships, customization, and Laravel-specific integrations.EntityFactory may introduce breaking changes in how models/relationships are processed. Verify if the new API retains compatibility with Laravel’s factory system or introduces friction (e.g., deprecated methods, renamed classes).EntityFactory likely introduces:
EntityFaker::create() → new syntax).Factory class).User ↔ Post ↔ User).createMany()).EntityFaker::seed(1234); // Verify this works in v2.0.0
EntityFactory deprecate or replace the old EntityFaker facade?EntityFaker for what-if scenarios (e.g., edge cases) where factories are rigid.EntityFaker (e.g., create(), createMany(), custom rules).EntityFaker::rule() → new syntax).User, Product to test the new factory.User::posts) with the redesigned API.create() calls with the new syntax.app/Services/FakeDataService.php).EntityFactory::create()).created, updated hooks fire correctly.try {
EntityFactory::create(User::class, ['email' => 'duplicate@example.com']);
} catch (\Illuminate\Database\QueryException $e) {
// Expected for duplicate emails
}
EntityFaker facade is soft-deprecated or removed.composer require butschster/entity-faker:^2.0.php artisan vendor:publish if config changes exist.use Butschster\EntityFaker\EntityFactory; // Check new namespace/class
$fakeUser = EntityFactory::create(User::class); // New method?
$fakeUser = EntityFactory::create(User::class, [
'posts' => EntityFactory::create(Post::class, 3) // New syntax?
]);
EntityFactory::rule(User::class, 'email', fn() => 'user_' . Str::random(8) . '@example.com');
1000 entities to catch memory leaks.^2.0 in composer.json to avoid unintended updates.How can I help you explore Laravel packages today?