# Pest — Elegant PHP Testing Framework > Pest is a testing framework for PHP that focuses on simplicity and developer experience, offering an expressive syntax built on top of PHPUnit. ## Install Save in your project root: # Pest — Elegant PHP Testing Framework ## Quick Use ```bash composer require pestphp/pest --dev --with-all-dependencies ./vendor/bin/pest --init ./vendor/bin/pest ``` ## Introduction Pest brings a clean, minimal syntax to PHP testing inspired by Jest and RSpec. It wraps PHPUnit so existing test suites can adopt Pest incrementally without rewriting anything. ## What Pest Does - Provides a fluent closure-based test syntax for PHP - Runs on top of PHPUnit with full compatibility - Offers built-in architecture testing for enforcing code rules - Supports parallel test execution and test profiling - Includes snapshot testing and type coverage analysis ## Architecture Overview Pest is a thin layer over PHPUnit that transforms its closure-based `test()` and `it()` calls into standard PHPUnit test cases at runtime. Test files are plain PHP scripts without class boilerplate. Pest discovers and loads them through its own test suite loader, then delegates execution to the PHPUnit engine. ## Self-Hosting & Configuration - Install via Composer as a dev dependency - Initialize with `./vendor/bin/pest --init` to scaffold config - Configure in `pest.php` or fall back to `phpunit.xml` - Use `--parallel` flag to run tests across multiple processes - Integrate with CI by running `./vendor/bin/pest --ci` ## Key Features - Minimal closure-based test syntax with zero class boilerplate - Architecture testing to enforce dependency and namespace rules - Built-in code coverage and type coverage reporting - Snapshot testing for complex output assertions - Parallel execution for faster test suite runs ## Comparison with Similar Tools - **PHPUnit** — class-based tests with more ceremony; Pest wraps PHPUnit with a simpler API - **Codeception** — full-stack BDD testing; Pest focuses on unit and feature tests with less setup - **PHPSpec** — spec-driven design tool; Pest is a general-purpose test runner - **Jest** — JavaScript testing; Pest brings a similar developer experience to PHP - **Behat** — behavior-driven with Gherkin syntax; Pest uses plain PHP closures ## FAQ **Q: Can I use Pest alongside existing PHPUnit tests?** A: Yes. Pest is fully compatible with PHPUnit. Both styles can coexist in the same project. **Q: Does Pest support Laravel?** A: Yes. The `pestphp/pest-plugin-laravel` package adds Laravel-specific helpers and assertions. **Q: Is Pest slower than PHPUnit?** A: No. Pest adds negligible overhead since it delegates execution to PHPUnit internally. **Q: What PHP versions does Pest support?** A: Pest v3 requires PHP 8.2 or higher. ## Sources - https://github.com/pestphp/pest - https://pestphp.com/docs/installation --- Source: https://tokrepo.com/en/workflows/asset-d1ced1c9 Author: AI Open Source