hamcrest/hamcrest-php
PHP Hamcrest implementation [Official] observed · 2026-08-28
Health v2 · maintenance only
80/100
- Activity 88
- Release rhythm 57
- Longevity 100
Flags: no_license
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: 206.0
- age_days: 4628
- days_rel: 78
- days_push: 77
- n_releases_24m: 3
Adoption not part of the score
6994 stars · 47 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
The official PHP port of the Hamcrest matcher library, providing a fluent set of matchers for writing expressive assertions in tests. It follows the original Java API closely and integrates with PHPUnit via MatcherAssert and global proxy functions.
Use cases
- write readable assertions in phpunit tests
- match values with expressive matchers like equalTo or containsString
- combine matchers with both/andAlso and either/orElse
- avoid risky test warnings by counting hamcrest assertions
- port java hamcrest test styles to php
When to choose
- you want declarative, composable matchers instead of plain assert calls
- you are already using PHPUnit and want richer assertion expressiveness
- you are porting Hamcrest-based tests from Java or other languages to PHP
When to avoid
- you prefer PHPUnit's built-in assertions without extra dependencies
- you need collection matchers that have not been ported yet
- your project does not use PHP
Facets
library · maturity stable
testing mocking testing developer-tools php hamcrest matchers assertions unit-testing phpunit
1 source
- readme: https://github.com/hamcrest/hamcrest-php · fetched 2026-08-28 · dc1922a338fc
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| hamcrest/hamcrest-php | main | 80 |
For agents
markdown · JSON · MCP: product_card(name="hamcrest/hamcrest-php")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem