PHPackages                             skie/cakephp-factory-muffin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. skie/cakephp-factory-muffin

ActiveCakephp-plugin[Search &amp; Filtering](/categories/search)

skie/cakephp-factory-muffin
===========================

CakePHP FactoryMuffin integration plugin

1.0.3(9y ago)322.9k1[1 issues](https://github.com/skie/cakephp-factory-muffin/issues)MITPHP

Since May 7Pushed 9y ago2 watchersCompare

[ Source](https://github.com/skie/cakephp-factory-muffin)[ Packagist](https://packagist.org/packages/skie/cakephp-factory-muffin)[ Docs](https://github.com/skie/cakephp-factory-muffin)[ RSS](/packages/skie-cakephp-factory-muffin/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

CakePHP FactoryMuffin Integration Plugin
========================================

[](#cakephp-factorymuffin-integration-plugin)

Plugin integrates FactoryMuffin and Faker for seeding and testing.

### Provided features

[](#provided-features)

- CakePHP ORM integration for FactoryMuffin.
- Easy to inject into your project.

Installing
----------

[](#installing)

[PHP](https://php.net) 5.6+ and [Composer](https://getcomposer.org) are required.

In your composer.json, simply add `"skie/cakephp-factory-muffin": "*"` to your `"require"` section:

```
{
    "require": {
        "skie/cakephp-factory-muffin": "*"
    }
}
```

Factory definition.
-------------------

[](#factory-definition)

Define factory classes in `App\Model\Factory` namespace for application level, in `${PluginScope}\Model\Factory` for plugins.

Each factory class should contain definition method that describe how to create entity.

By convention factory classes should match with Table classes name but with `Factory` suffix.

```
namespace App\Model\Factory;

use CakephpFactoryMuffin\Model\Factory\AbstractFactory;
use League\FactoryMuffin\Faker\Facade as Faker;

class UsersFactory extends AbstractFactory {

    public function definition()
    {
        return [
            'first_name' => Faker::firstName(),
            'last_name' => Faker::lastName(),
            'username' => function ($object, $saved) {
                return strtolower($object['last_name'] . '_' . $object['first_name']);
            },
            'password' => Faker::word(),
        ];
    }
}
```

Usage
-----

[](#usage)

In tests or seed files you can use `CakephpFactoryMuffin\FactoryLoader` objects that manage Factory loading and dispatch creation process to FactoryMuffin.

This class perform cakephp orm integration with FactoryMuffin and serve cakephp tables naming conventions like 'Users', or 'Plugin.Records'.

To load factory definition one can use `FactoryLoader::load('Users')`. To load all applicaiton level factories use `FactoryLoader::loadAll()`. And to load factories for plugin Plugin/Name use `FactoryLoader::loadAll('Plugin/Name')`.

Example
-------

[](#example)

```
FactoryLoader::load('Users');
$user = FactoryLoader::create('Users');
$users = FactoryLoader::seed(10, 'Users');
```

Here created 11 users records in database.

In tests we need to flush created objects. It could be achieved by call
-----------------------------------------------------------------------

[](#in-tests-we-need-to-flush-created-objects-it-could-be-achieved-by-call)

```
FactoryLoader::getInstance()->getFactoryMuffin()->deleteSaved();
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

3344d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1f53020a99b0b08cda73130f837f37cae2ae8420ff0cc4ceb650a733c4a1bd6?d=identicon)[skiedr](/maintainers/skiedr)

---

Top Contributors

[![skie](https://avatars.githubusercontent.com/u/130799?v=4)](https://github.com/skie "skie (11 commits)")[![borantula](https://avatars.githubusercontent.com/u/1006583?v=4)](https://github.com/borantula "borantula (1 commits)")

---

Tags

searchcakephpfiltercake

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/skie-cakephp-factory-muffin/health.svg)

```
[![Health](https://phpackages.com/badges/skie-cakephp-factory-muffin/health.svg)](https://phpackages.com/packages/skie-cakephp-factory-muffin)
```

###  Alternatives

[friendsofcake/search

CakePHP Search plugin using PRG pattern

1722.2M50](/packages/friendsofcake-search)[skie/cakephp-search

CakePHP Plum Search plugin

19198.7k3](/packages/skie-cakephp-search)[cakephp/bake

Bake plugin for CakePHP

11212.0M202](/packages/cakephp-bake)[dereuromark/cakephp-queue

The Queue plugin for CakePHP provides deferred task execution.

308954.9k25](/packages/dereuromark-cakephp-queue)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1882.3M44](/packages/dereuromark-cakephp-ide-helper)[bedita/manager

BEdita Manager - official admin webapp for BEdita4 API

131.2k](/packages/bedita-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
