league/factory-muffin-faker
Wraps Faker generators in deferred closures for easy use with Factory Muffin or any factory setup. Lets you define attributes with Faker and execute generation later, keeping factories simple and flexible. Compatible with PHP 5.4+ via Composer.
Pros:
DatabaseMigrations, DatabaseTransactions) by providing a clean, lazy-loaded way to generate fake data for factories.Illuminate\Database\Eloquent\Factories\Factory or third-party factory solutions (e.g., mollie/factories).name, address, internet) without requiring direct Faker instantiation, reducing boilerplate.Cons:
Model::factory()->count(1000)->create()).PHPUnit or Pest tests, especially for complex relationships.use League\FactoryMuffinFaker\FactoryMuffinFaker;
use Faker\Factory as FakerFactory;
$faker = new FactoryMuffinFaker(FakerFactory::create());
$userFactory = new UserFactory($faker); // Hypothetical Laravel-compatible factory
new Factory() with a closure, while Factory Muffin uses a different syntax. Adapters may be needed.Post::factory()->for(User::factory())).^1.9.1) to avoid breaking changes.laravel-shift/database-factory-boy)? Assess overlap and redundancy.factory() calls with lazy-loaded Faker closures in PHPUnit/Pest tests.Factory class with Factory Muffin Faker’s lazy evaluation.RefreshDatabase trait for ephemeral test databases.Model::factory(), create_fake() helpers).User) using the package, comparing performance and code clarity vs. current methods.// Current (Laravel)
User::factory()->create(['name' => 'John Doe']);
// Proposed (Factory Muffin Faker)
$faker = new FactoryMuffinFaker(Faker::create());
$userFactory = new UserFactory($faker);
$user = $userFactory->create(['name' => $faker->name]);
Post, Comment) to validate the approach.LaravelFactoryMuffinFaker) to bridge Factory Muffin’s API with Laravel’s factories.mollie/factories).fakerphp/faker-providers) are installed for custom data formats.User, Product).Post belongsTo User) with custom factory logic.RefreshDatabase) and benchmark against existing methods.dd($faker->getGenerator()) to inspect state.How can I help you explore Laravel packages today?