Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pest Laravel Package

pestphp/pest

Pest is an elegant PHP testing framework focused on simplicity and joyful, expressive tests. Built for modern PHP projects, it offers a clean syntax, rich assertions, plugins, and great developer experience for unit, feature, and more.

View on GitHub
Deep Wiki
Context7

Pest is an elegant PHP testing framework focused on simplicity and readability, designed to make writing tests enjoyable again. Built on top of PHPUnit, it provides a modern, expressive API that fits naturally into your workflow—whether you’re testing a small package or a large Laravel app.

  • Expressive syntax for fast, readable tests
  • PHPUnit compatible and integrates with existing tooling
  • Rich expectations & plugins to extend testing capabilities
  • Great developer experience with clear output and ergonomics
  • Comprehensive documentation at pestphp.com
Frequently asked questions about Pest
How do I migrate from PHPUnit to Pest in a Laravel project?
Pest is a drop-in replacement for PHPUnit in Laravel. Replace `phpunit` with `pest` in your `composer.json` scripts, then update your test files by changing `test()` to `it()` and `assert()` to `expect()`. Laravel’s built-in test helpers (like `actingAs()` or `refreshDatabase()`) work unchanged. Run `composer require pestphp/pest --dev` to start.
Does Pest support Laravel 10/11 and PHP 8.3+?
Yes, Pest is fully compatible with Laravel 10/11 and PHP 8.3+. It leverages modern PHP features like attributes and typed properties while maintaining backward compatibility with older Laravel versions. Check the [Pest docs](https://pestphp.com) for version-specific guides.
Can I use Pest for browser testing in Laravel?
Absolutely. Pest integrates with Playwright for end-to-end testing via the `pest-plugin-playwright` package. It pre-configures headless Chrome/Firefox for Laravel, so you can write tests like `it('loads the homepage', fn() => $page->expect('h1')->toHaveText('Welcome'))` with minimal setup.
Will Pest break my existing PHPUnit custom assertions or listeners?
Pest replaces PHPUnit’s test runner but abstracts away most boilerplate. Custom assertions or listeners may need refactoring—especially if they rely on PHPUnit-specific internals. Start with a subset of tests to identify compatibility gaps, and use Pest’s `extend()` method to adapt legacy logic.
How does Pest handle database testing in Laravel?
Pest works seamlessly with Laravel’s database testing tools like `refreshDatabase()`, `migrate()`, and `withoutExceptionHandling()`. Each test runs in a fresh transaction by default, and you can use Pest’s `create()` helper to generate test models with relationships, just like PHPUnit.
Is Pest faster than PHPUnit for Laravel projects?
Yes, Pest is optimized for speed with a modern test runner. It skips PHPUnit’s legacy overhead while maintaining compatibility. For parallel testing, use `pest --parallel` or integrate with Paratest. Pest’s lightweight design also reduces bootstrapping time in CI pipelines.
Can I enforce clean architecture with Pest?
Yes, use the `pest-plugin-arch` package to statically analyze your codebase for architecture violations (e.g., services calling databases directly). It integrates with Pest’s test suite to fail builds when rules are broken, helping enforce SOLID principles without manual reviews.
Does Pest require Node.js for Playwright browser testing?
Yes, Playwright requires Node.js (v16+) for browser automation. If your CI environment lacks Node.js, use Docker containers with Playwright pre-installed or configure a multi-stage build. Pest provides [CI templates](https://pestphp.com/docs#ci) to simplify setup.
What’s the learning curve for developers new to Pest?
The syntax shift from `assertTrue()` to `expect($value)->toBeTrue()` takes ~1–2 days for most teams. Pest’s API mirrors PHPUnit’s intent but is more expressive. Laravel developers familiar with testing helpers will adapt quickly. Start with the [migration guide](https://pestphp.com/docs/migration) for a smooth transition.
Are there alternatives to Pest for Laravel testing?
PHPUnit remains the dominant choice, but Pest offers a more modern, Laravel-native experience. For lightweight testing, consider `brombos/laravel-testing` (PHPUnit wrapper), but it lacks Pest’s extensibility (e.g., Playwright, architecture plugins). If you need strict PHPUnit compatibility, stick with it—but Pest reduces boilerplate by ~70%.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport