dereuromark/cakephp-fixture-factories

CakePHP Dynamic Fixtures

Installs: 5 603

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 22

Open Issues: 1

Type:cakephp-plugin

pkg:composer/dereuromark/cakephp-fixture-factories

1.3.0 2026-02-03 01:47 UTC

This package is auto-updated.

Last update: 2026-02-22 17:39:38 UTC


README

ff-logo

CakePHP Fixture Factories

Write and run your tests faster. On any PHP application.

Build Status Coverage Status Latest Stable Version Minimum PHP Version PHPStan Level 8 License Total Downloads

Note: This is a maintained fork of the original CakePHPFixtureFactories.

Main differences:

  • Supports multiple generators via adapters (chose your generator library).
  • Modern configurable generator type guessing per field name/type when baking.

Migrating from vierge-noire/cakephp-fixture-factories

If you're upgrading from vierge-noire/cakephp-fixture-factories:^3.0, the main breaking change is the generator type. Callbacks in setDefaultTemplate() now receive GeneratorInterface instead of Faker\Generator:

- use Faker\Generator;
+ use CakephpFixtureFactories\Generator\GeneratorInterface;

  protected function setDefaultTemplate(): void
  {
-     $this->setDefaultData(function (Generator $faker) {
+     $this->setDefaultData(function (GeneratorInterface $generator) {
          return [
-             'email' => $faker->email,
+             'email' => $generator->email(),
          ];
      });
  }

Key changes:

  • Replace Faker\Generator type hints with GeneratorInterface
  • Use $this->getGenerator() instead of deprecated $this->getFaker()
  • Prefer method calls ->email() over property access ->email (both work)

See Generator Differences for details on the abstraction layer.

ArticleFactory::make(5)
    ->with('Authors[3].Address.City.Country')
    ->persist();

Installation

composer require --dev dereuromark/cakephp-fixture-factories

Content

Resources

CakeFest 2021 - IPC-Berlin 2020 - CakeFest 2020

Contribute

Send PRs or tickets in GitHub.

Authors

Previously, Juan Pablo Ramirez and Nicolas Masson. This fork is maintained by Mark Scherer (dereuromark)

License

The CakePHPFixtureFactories plugin is offered under an MIT license.

Copyright 2023 Juan Pablo Ramirez and Nicolas Masson

Licensed under The MIT License Redistributions of files must retain the above copyright notice.