PEST is a modern testing framework for PHP that focuses on clean syntax, readability, and developer experience. It builds on PHPUnit but provides a much more expressive and minimalistic interface.
📌 PEST = "PHP Testing for Humans"
It’s designed for developers who want to write fast, readable, and elegant tests — with less boilerplate.
PEST is built on top of PHPUnit, but it:
Provides a cleaner, simpler syntax
Removes unnecessary structure
Encourages a functional, behavior-driven style
Still supports traditional PHPUnit classes if needed
PHPUnit:
class UserTest extends TestCase
{
public function test_user_has_name()
{
$user = new User('John');
$this->assertEquals('John', $user->name);
}
}
PEST:
it('has a name', function () {
$user = new User('John');
expect($user->name)->toBe('John');
});
👉 Much shorter and easier to read — especially when writing many tests.
✅ Elegant, expressive syntax (inspired by Jest/Mocha)
🧪 Supports unit, feature, API, and browser-based testing
🧱 Data-driven testing via with([...])
🧬 Test hooks like beforeEach()
/ afterEach()
🎨 Fully extensible with plugins and custom expectations
🔄 Fully compatible with PHPUnit — you can run both side by side
In a Laravel or Composer project:
composer require pestphp/pest --dev
php artisan pest:install # for Laravel projects
Then run tests:
./vendor/bin/pest
PEST is ideal if you:
Want to write tests that are fun and easy to maintain
Prefer clean, modern syntax
Already use PHPUnit but want a better experience
💡 Many Laravel developers are adopting PEST because it integrates seamlessly with Laravel and truly makes testing feel "human" — just like its slogan says.