Specification-oriented BDD framework for PHP
open sourceMITfree
phpspec is a specification-oriented behaviour-driven development framework for PHP 8.3 and later: you describe how a class should behave in specs, and phpspec drives its design and can generate the code. Version 9 is a complete rewrite that replaces the ObjectBehavior base class with a closure-based DSL inspired by RSpec and Jasmine, and adds a pair programming mode in which an LLM writes specs, generates code and refactors, driven by your specifications.
Problems it solves
- write behaviour-driven specs for my PHP classes before the code
- let my PHP specs drive the design and generate class skeletons
- an RSpec-style testing framework for PHP
Features
- specification-oriented BDD
- code generation from specs
- closure-based DSL inspired by RSpec and Jasmine (v9)
- AI pair programming mode
Alternatives
The same job
These do what phpspec does.
- Behat Behaviour-driven development for PHP
- Pest The elegant PHP testing framework
- PHPUnit The testing framework for PHP
- Codeception Full-stack testing framework for PHP
