PHPackages                             exan/moock - 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. exan/moock

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

exan/moock
==========

Modern class mocking package

0.1.16(1mo ago)028MITPHPCI passing

Since Dec 18Pushed 1mo agoCompare

[ Source](https://github.com/Exanlv/moock)[ Packagist](https://packagist.org/packages/exan/moock)[ RSS](/packages/exan-moock/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (25)Used By (0)

Moock
=====

[](#moock)

 [![Moock logo](moock.png)](moock.png)
 A simple way of mocking objects in PHP

Installation
------------

[](#installation)

```
composer require exan/moock
```

About
-----

[](#about)

Moock is a package to abstract creating test dummies for objects, intended to be used in unit tests. Using test dummies allows you to write more specific tests, where you don't have to worry about a class's dependencies. This works best when using the Dependency Injection pattern.

Check out the docs [here!](./documentation.md)

### Sales pitch

[](#sales-pitch)

If you're looking into this library, there's a good chance you already know of some other mocking library. For Moock, the goal is to rely on PHP language tricks as much as possible for the syntax. This makes it so IDE's don't (or shouldn't) need specific extensions to get nice auto-complete, or to support refactoring method names.

Take for example the mocking of methods:

```
/** @var MyClass */
$myMock;

Mock::method($myMock->someMethod(...));
```

If you go ahead and rename `someMethod` on `MyClass`, your IDE will properly recognize it in your creation of mocks, and thus also rename it there.

This can be achieved extensions specific to your IDE &amp; mocking library of choice too, of course. Relying on these specific types of extensions however, is not my personal preference.

### Conscious omissions

[](#conscious-omissions)

There are some features you may take for granted in other libraries, including but not limited to:

- Overloading
- Mocking protected/private methods
- Mocking static methods

These are (opinionated) conscious omissions. These features can lead you down a path of hard to maintain tests, or tests which don't meaningfully test your application.

If you are missing a feature, please consider the above. If you don't think it applies, please create an issue with your request.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance91

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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.

###  Release Activity

Cadence

Every ~5 days

Total

20

Last Release

49d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a13e10cab42385db1f6f4f0bfd96f8c63ec419746648db02b30e7ea02d2f5df?d=identicon)[exan](/maintainers/exan)

---

Top Contributors

[![Exanlv](https://avatars.githubusercontent.com/u/51094537?v=4)](https://github.com/Exanlv "Exanlv (76 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/exan-moock/health.svg)

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

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/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.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

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