# mockery/mockery

Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL).

Repository: https://github.com/mockery/mockery
Canonical: https://ross.abutalabs.com/products/mockery
Homepage: http://docs.mockery.io/en/stable/
Language: PHP
License: BSD-3-Clause
License Family: permissive
Topics: mockery, phpunit, php, stub, mock, mocking, test-doubles
Last push: 2026-08-20T01:59:25+00:00

## Health v2 (maintenance only)
Score: 98/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 98, longevity 100
- inputs: {"age_days": 6398, "days_push": 14, "days_rel": 14, "gap_med": 1.5, "n_releases_24m": 3}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 10724, forks 469 (observed 2026-08-28T04:10:43.866121+00:00)

## What it is
Mockery is a flexible PHP mock object framework for creating test doubles in unit tests. It provides a human-readable DSL for defining expected method calls and return values, integrating with PHPUnit, PHPSpec, or any other testing framework.

## Use cases
- mock objects in phpunit tests
- create stubs and test doubles in php
- replace phpunit-mock-objects with a better mocking dsl
- spy on method calls in php unit tests
- mock final classes and static methods in php
- isolate unit tests from dependencies

## When to choose
- you write PHP unit tests and need expressive mock objects, stubs, or spies
- you want a drop-in alternative to PHPUnit's built-in mock objects with a richer DSL
- you need to mock fluent interfaces, magic methods, or partial mocks

## When to avoid
- you are testing code in a language other than PHP
- your tests only need simple stubs already covered by PHPUnit's built-in mocking

## Facets
- artifact type: library
- maturity: stable
- function: mocking, testing
- domain: testing, developer-tools
- platform: php, cli
- tags: test-doubles, phpunit, phpspec, unit-testing, stubs, spies, php

## Member repositories
- mockery/mockery (main) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:43.866121+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:17:56.423672+00:00, confidence not recorded.
  - readme: https://github.com/mockery/mockery (fetched 2026-08-28T04:10:43.866121+00:00, sha fc16b49cbedc)
  - homepage: http://docs.mockery.io/en/stable/ (fetched 2026-08-29T08:17:01.057230+00:00, sha 518d44517119)
  - site_page: http://docs.mockery.io/en/stable/getting_started/installation.html (fetched 2026-08-29T08:17:01.066419+00:00, sha 7dde64d2fd3b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
