pestphp/pest
Pest is an elegant PHP testing framework focused on simplicity and a joyful developer experience. Write expressive tests with a clean syntax, run fast suites, and scale from tiny projects to large apps. Full docs at pestphp.com.
test('user creates post', ...) vs. PHPUnit’s public function testUserCreatesPost()) aligns with roadmap goals to reduce cognitive load for developers, particularly junior engineers or contributors. This directly supports initiatives to lower onboarding time and improve code maintainability.--update-shards) and parallel execution (--parallel) enable 30–60% faster test suites, critical for scaling CI pipelines. This supports roadmap items targeting faster feedback loops and reduced CI costs (e.g., AWS/GitHub Actions minutes).toBeAuthenticated()) make it a low-risk upgrade path for legacy PHP codebases. Supports roadmap goals to refactor technical debt without rewriting tests.toUseTrait(), toExtend()) helps enforce clean code principles (e.g., SOLID, DDD). Aligns with initiatives to standardize code quality across teams.Build vs. Buy:
Adopt Pest if:
setUp(), assert* methods).Look Elsewhere if:
For Executives (Business Impact): *"Pest is a game-changer for our PHP/Laravel development velocity. By replacing PHPUnit with Pest, we can:
ROI: For a team of 10 engineers, Pest could save ~100 dev hours/year in test maintenance and $15K+ in CI costs. The MIT license and Laravel creator backing (Nuno Maduro) eliminate vendor lock-in risk."*
For Engineering Leaders (Technical Impact): *"Pest solves three critical pain points in our testing workflow:
test('user resets password') vs. public function testUserResetsPassword()). This is especially valuable for onboarding juniors or open-source contributors.--update-shards command auto-balances test distribution, so we don’t manually optimize.Migration Path:
toUseTrait('ShouldBeJsonSerializable')).Risks Mitigated:
For Developers (Day-to-Day Value): *"Pest makes testing fun again. Here’s what you’ll love:
setUp() hell: Use beforeEach() to share setup logic without classes.expect($response)->toBeSuccessful() vs. assertEquals(200, $response->status()).actingAs(), toHaveHttpStatus(), and toBeAuthenticated().--parallel) and sharding (--shard) make your PRs merge without waiting for CI.Example:
// Before (PHPUnit)
public function test_user_creation() {
$user = User::factory()->create();
$response = $this->post('/users', $user->toArray());
$response->assertStatus(201);
}
// After (Pest)
test('user can be created', function () {
$user = User::factory();
$response = post('/users', $user->toArray());
expect($response)->toBeSuccessful()
->json(['id' => $user->id]);
});
Try It:
composer require pestphp/pest --dev --with-all-dependencies./vendor/bin/pestHow can I help you explore Laravel packages today?