hoa/praspel
Hoa\Praspel brings Design by Contract to PHP: write behavioral specifications with preconditions, postconditions and invariants, then automatically generate test data to validate your code. A concise specification and testing toolkit for robust PHP libraries.
@requires, @ensures, @invariant, @throwable) paired with a generative data engine (Hoa\Realdom) that produces inputs satisfying the declared preconditions. It is the clearest prior art for "specify the contract, generate the cases" in the PHP ecosystem — useful evidence when deciding whether to fund property-based testing beyond hand-written unit tests.Consider (narrowly) when:
composer require.Look elsewhere when:
For executives (one paragraph). Praspel is an abandoned 2017 research library that lets PHP developers declare formal contracts on their code and auto-generate test inputs from them. We are not recommending adoption — it is archived, has zero downstream users, and will not run on current PHP. Its value is as a cheap blueprint: a one-to-two day engineering spike tells us whether contract-driven and generative testing meaningfully reduce defects in our highest-risk domain logic, and lets us build that capability on maintained tooling instead of inheriting an unmaintained dependency. Cost: negligible. Downside risk: contained to the spike.
For engineering leadership. Recommendation is a time-boxed spike, not a platform bet. Success criteria: (1) a reproducible generative test catches at least one real edge case in a target module (pricing, money, or order state), and (2) a written go/no-go on a thin internal contract layer versus adopting Eris + static analysis. Explicit non-goal: adding hoa/praspel to composer.json.
For the engineering team. Steal the ideas, not the dependency. Read the contract grammar and the precondition-to-data-generation mapping; then implement the minimal subset that earns its keep — asserted invariants on value objects, plus generative tests for the two or three modules where a wrong answer is expensive. Everything else stays PHPUnit.
How can I help you explore Laravel packages today?