Installation

Note: Pest requires PHP 7.3+ to work.

  1. Check that you have a phpunit.xml file at the root of your project. Otherwise, download this one.

  2. Make sure your existing composer.json file contains the following options:

"minimum-stability": "dev",
"prefer-stable": true,
  1. Then, make sure your PHPUnit dependency is set to ^9.0:
composer require phpunit/phpunit:"^9.0" --dev --update-with-dependencies
  1. If you are using Laravel, make sure your Collision dependency is set to ^5.0:
composer require nunomaduro/collision:"^5.0" --dev --update-with-dependencies
  1. Next, require Pest:
composer require pestphp/pest --dev
  1. Now, it's time to setup your Pest test suite.
  • On Laravel, require the pest-plugin-laravel and run the pest:install Artisan command:
composer require pestphp/pest-plugin-laravel --dev && php artisan pest:install
  • On other projects, run the pest --init command:
./vendor/bin/pest --init
  1. Finally, you can run Pest directly from the command line:
./vendor/bin/pest

Install

On the next section, we are going to learn how to write tests with Pest: Writing Tests →