phpspec
phpspec is a free PHP toolset for shaping code through specification-driven development.
What phpspec is
phpspec is a free PHP toolset for shaping code through specification-driven development. Its SpecBDD workflow starts by describing an object’s behavior, implementing enough code to satisfy that description, and then refactoring. The manual focuses on specifying how classes implement features at the implementation level. A describe command can generate specification and source class files according to configured naming and path rules. Built-in matchers cover identity, comparison, exceptions, types, object state, counts, iterables, and strings. Collaborator behavior can use stubs for return values, mocks for expected calls, and spies for checking calls after execution. Project settings can be stored in phpspec.yml, .phpspec.yml, or phpspec.yml.dist, covering suites, paths, formatters, extensions, and bootstrapping. Built-in output formats include progress, html, pretty, junit, dot, and tap. Extensions can add formatters and custom matcher classes. phpspec runs locally on Linux in a self-hosted setup and installs through Composer as a project development dependency.
Good
- Free PHP specification toolset
- Supports stubs, mocks, and spies
- Includes multiple built-in output formats
- Describe command generates spec and source files
- Extensions can add matchers and formatters
Watch out
- Requires PHP 5.6 or 7 according to installation guidance
- Linux self-hosted execution only
- No Gherkin support
Who it suits
It suits PHP developers who want implementation-level specifications and a SpecBDD workflow. Teams working locally on Linux projects can install it through Composer.
Verdict
phpspec provides a focused specification workflow with matchers, test doubles, configurable output, and code generation. It fits PHP projects that prefer local, Composer-managed development tooling.
Plans and prices
From phpspec's own pricing page, checked 4 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| phpspec | Free | PHP SpecBDD framework · installed as a project development dependency through Composer |
The facts
Each one read from phpspec's own pages, with the date it was checked.
What it does
- BDD workflow
- Its SpecBDD workflow describes an object's behavior, implements enough code to meet the specification, and then refactors the code.checked 4 Oct 2026
- Code generation
- The configuration page documents a describe command that creates spec and source class files according to configured naming and path rules.checked 4 Oct 2026
- Configuration
- Project settings can be supplied in phpspec.yml, .phpspec.yml, or phpspec.yml.dist, with options for suites, paths, formatters, extensions, and bootstrapping.checked 4 Oct 2026
- Distribution
- The official site directs users to install phpspec in a PHP project with Composer and run its executable from the project bin directory.checked 4 Oct 2026
- Extension support
- The manual says extensions can add formatters and register custom matcher classes.checked 4 Oct 2026
- Installation
- The manual says to install phpspec and its dependencies through Composer as a project development dependency.checked 4 Oct 2026
- Intended use
- The manual describes phpspec as a tool for specifying how classes implement features, at the implementation level.checked 4 Oct 2026
- Matchers
- The manual lists built-in matchers for identity, comparison, exceptions, types, object state, counts, iterables, and strings.checked 4 Oct 2026
- Output formats
- The configuration manual lists progress, html, pretty, junit, dot, and tap as built-in formatters.checked 4 Oct 2026
- PHP requirement
- The installation page says to ensure PHP 5.6 or 7 is installed.checked 4 Oct 2026
- Purpose
- phpspec is a PHP toolset for driving emergent design by specification.checked 4 Oct 2026
- Test doubles
- The manual documents using stubs to specify collaborator return values, mocks to expect calls, and spies to check calls after behavior runs.checked 4 Oct 2026
Alternatives to phpspec
- 1

Karate
Free planOpen sourceAPIExtensionLinuxmacOS8.2From $100 a year - 2
FitNesse
Free planWebAPILinuxmacOS6.7Free plan - 3

Reqnroll
Free planWindowsmacOSLinux6.7From €400 a year - 4
BddDotNet
Free planLinuxmacOSWindows6.6Free plan - 5
BDDX
Free planWeb6.6From $9.99 a month - 6

Cucumber Open
Free planAndroidAPILinuxmacOS6.6Free plan
