Mockery logo

Mockery

Flexible PHP mock-object framework with Hamcrest-style matchers, supporting partial mocks, static-method mocks and chained expectations.

-

Our Verdict

The go-to PHP mocking lib when PHPUnit mocks run out of steam, used with the usual mock-overuse caveat.

Pros

  • Expressive Hamcrest-style matchers
  • Handles partial and static mocks well
  • Chained expectations read naturally
  • Integrates cleanly with PHPUnit

Cons

  • More flexible means easier to misuse
  • Static mocks couple tests to globals
  • Overlap with PHPUnit's own mocks confuses newcomers
  • Debugging failed expectations can be cryptic
Best for: PHP teams needing expressive mocks for legacy or static-heavy code Not for: Projects where PHPUnit's built-in mocking is already sufficient

When to Use Mockery

Good fit if you need

  • PHP mock objects with fluent expectation DSL
  • Partial mocks for legacy PHP class isolation
  • Static method mocking with overload mocks
  • Hamcrest-style matchers for flexible argument assertions

Lock-in Assessment

High 5/5
Lock-in Score
5/5

Mockery Pricing

Pricing Model
free
Free Tier
Yes
Entry Price
Enterprise Available
No
Transparency Score

Beta — estimates may differ from actual pricing

1,000
1001K10K100K1M

Estimated Monthly Cost

$25

Estimated Annual Cost

$300

Estimates are approximate and may not reflect current pricing. Always check the official pricing page.

Project Health

B

Health Score

10.7k 462
Bus Factor

10

Last Commit

20 days

Release Freq

16d

Open Issues

115

Issue Response

N/A

License

BSD-3-Clause

Last checked: 2026-04-21

Community Discussion

Comments powered by Giscus (GitHub Discussions). You need a GitHub account to comment.