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.3.10:
composer require phpunit/phpunit:"^9.3.10" --dev --update-with-dependencies

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

Install Pest

Now you can require Pest:

composer require pestphp/pest --dev

Setup the test suite

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

Run Pest

Finally, you can run Pest directly from the command line:



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