PHPackages                             timg/fuzzymock - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. timg/fuzzymock

ActiveLibrary[Testing &amp; Quality](/categories/testing)

timg/fuzzymock
==============

57PHP

Since Jun 22Pushed 7y ago2 watchersCompare

[ Source](https://github.com/timglabisch/fuzzmock)[ Packagist](https://packagist.org/packages/timg/fuzzymock)[ RSS](/packages/timg-fuzzymock/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

fuzzmock
========

[](#fuzzmock)

```
composer require timg/fuzzymock

```

Fuzzymock is a small library that helps to create tests for edge-cases.

Sometimes you want to check if 2 different implementations that are using such a class are working the same way. Something like:

```
static::assertEquals((new GreeterA)->greet($person), (new GreeterB)->greet($person));
```

consider you've such a `Person` class:

```
class Person {

    public $age;

    public function getAge() {
        return $this->age;
    }

}
```

you can create a FuzzyMock for the `Person`:

```
$fuzzyPersonMock = new \Tg\Fuzzymock\FuzzyBuilder(Person::class);
$fuzzyPersonMock->fn('getAge')
    ->couldReturn(new FuzzyFloat(1, 2, 2))
    ->couldReturn(new FuzzyCastString(new FuzzyInt()))
;

/** @var Person $person */
$personBuilder = $fuzzyPersonMock->createBuilder();

while (true) {
    $person = $personBuilder->createNew();
    echo $person->getAge() . "\n"; // a float, or a string containing a random int
}
```

the `createBuilder` method creates a PHP-Class on the fly (no reflection etc.). currently there are no benchmarks but FuzzyMock should be extrem fast.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

[![timglabisch](https://avatars.githubusercontent.com/u/689269?v=4)](https://github.com/timglabisch "timglabisch (11 commits)")

### Embed Badge

![Health badge](/badges/timg-fuzzymock/health.svg)

```
[![Health](https://phpackages.com/badges/timg-fuzzymock/health.svg)](https://phpackages.com/packages/timg-fuzzymock)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M678](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M752](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)

PHPackages © 2026

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