PHPackages                             brain/monkey - 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. brain/monkey

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

brain/monkey
============

Mocking utility for PHP functions and WordPress plugin API

2.7.0(3mo ago)33412.5M—0.2%27[8 issues](https://github.com/Brain-WP/BrainMonkey/issues)[1 PRs](https://github.com/Brain-WP/BrainMonkey/pulls)20MITPHPPHP &gt;=5.6.0CI passing

Since Mar 24Pushed 1mo ago7 watchersCompare

[ Source](https://github.com/Brain-WP/BrainMonkey)[ Packagist](https://packagist.org/packages/brain/monkey)[ RSS](/packages/brain-monkey/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (42)Used By (20)

README
======

[](#readme)

Brain Monkey
------------

[](#brain-monkey)

[![PHP Quality Assurance](https://github.com/Brain-WP/BrainMonkey/workflows/PHP%20Quality%20Assurance/badge.svg)](https://github.com/Brain-WP/BrainMonkey/actions?query=workflow%3A%22PHP+Quality+Assurance%22)[![codecov](https://camo.githubusercontent.com/e139339873c776d47f0f8a1b618602cd09ca8f4de4f4e0f3b8c184bb779bf089/68747470733a2f2f636f6465636f762e696f2f67682f427261696e2d57502f427261696e4d6f6e6b65792f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Brain-WP/BrainMonkey)

Brain Monkey is a tests utility for PHP.

It provides **two set of helpers**:

- the first are framework-agnostic tools that allow to mock (or *monkey patch*) and to test behavior of any **PHP function**
- the second are **specific to WordPress** and make unit testing of WordPress extensions a no-brainer.

Requirements
------------

[](#requirements)

- PHP 7.2+
- [Composer](https://getcomposer.org/) to install

Via Composer following packages are required:

- [mockery/mockery](https://packagist.org/packages/mockery/mockery) version 1 (BSD-3-Clause)
- [antecedent/patchwork](https://packagist.org/packages/antecedent/patchwork) version 2 (MIT)

When installed for development, following packages are also required:

- [phpunit/phpunit](https://packagist.org/packages/phpunit/phpunit) version 8.5 or higher (BSD-3-Clause)

License
-------

[](#license)

Brain Monkey is open source and released under MIT license. See LICENSE file for more info.

Question? Issues?
-----------------

[](#question-issues)

Brain Monkey is hosted on GitHub. Feel free to open issues there for suggestions, questions and real issues.

Who's Behind
------------

[](#whos-behind)

I'm Giuseppe, I deal with PHP since 2005. For questions, rants or chat ping me on Twitter ([@gmazzap](https://twitter.com/gmazzap)) or on ["The Loop"](https://chat.stackexchange.com/rooms/6/the-loop) (Stack Exchange) chat.

Well, it's possible I'll ignore rants.

###  Health Score

69

—

FairBetter than 100% of packages

Maintenance85

Actively maintained with recent releases

Popularity66

Solid adoption and visibility

Community45

Growing community involvement

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 68.4% 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 ~128 days

Recently: every ~486 days

Total

32

Last Release

102d ago

Major Versions

1.4.2 → 2.0.02017-05-24

1.5.0 → 2.0.22017-06-03

PHP version history (2 changes)1.3.2PHP &gt;=5.4.0

2.0.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2208282?v=4)[Giuseppe Mazzapica](/maintainers/gmazzap)[@gmazzap](https://github.com/gmazzap)

---

Top Contributors

[![gmazzap](https://avatars.githubusercontent.com/u/2208282?v=4)](https://github.com/gmazzap "gmazzap (275 commits)")[![jrfnl](https://avatars.githubusercontent.com/u/663378?v=4)](https://github.com/jrfnl "jrfnl (92 commits)")[![tfrommen](https://avatars.githubusercontent.com/u/6049306?v=4)](https://github.com/tfrommen "tfrommen (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![GaryJones](https://avatars.githubusercontent.com/u/88371?v=4)](https://github.com/GaryJones "GaryJones (3 commits)")[![shvlv](https://avatars.githubusercontent.com/u/3157352?v=4)](https://github.com/shvlv "shvlv (2 commits)")[![dnaber-de](https://avatars.githubusercontent.com/u/1133205?v=4)](https://github.com/dnaber-de "dnaber-de (2 commits)")[![widoz](https://avatars.githubusercontent.com/u/1917784?v=4)](https://github.com/widoz "widoz (1 commits)")[![Idealien](https://avatars.githubusercontent.com/u/4549984?v=4)](https://github.com/Idealien "Idealien (1 commits)")[![paulshryock](https://avatars.githubusercontent.com/u/7530507?v=4)](https://github.com/paulshryock "paulshryock (1 commits)")[![pospjan](https://avatars.githubusercontent.com/u/49492371?v=4)](https://github.com/pospjan "pospjan (1 commits)")[![Rarst](https://avatars.githubusercontent.com/u/737584?v=4)](https://github.com/Rarst "Rarst (1 commits)")[![smoothie](https://avatars.githubusercontent.com/u/16246859?v=4)](https://github.com/smoothie "smoothie (1 commits)")[![d3f3kt](https://avatars.githubusercontent.com/u/5670972?v=4)](https://github.com/d3f3kt "d3f3kt (1 commits)")

---

Tags

hacktoberfestmockerymockey-patchingphpphpunittestswordpresstestingtestmockerymockrunkitredefinitioninterceptionMonkey Patchingpatchworkmock functions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/brain-monkey/health.svg)

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

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[antecedent/patchwork

Method redefinition (monkey-patching) functionality for PHP.

45018.7M35](/packages/antecedent-patchwork)[php-mock/php-mock

PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.

36918.1M98](/packages/php-mock-php-mock)[kahlan/kahlan

The PHP Test Framework for Freedom, Truth and Justice.

1.2k1.2M247](/packages/kahlan-kahlan)[php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

392.1M96](/packages/php-mock-php-mock-mockery)[polishsymfonycommunity/symfony-mocker-container

Provides base Symfony dependency injection container enabling service mocking.

1468.0M237](/packages/polishsymfonycommunity-symfony-mocker-container)

PHPackages © 2026

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