Pest From Scratch

To install Pest on a new blank project, you just have to follow a few simple steps:

Note: Pest requires PHP 7.3+ to work.

  1. Inside a new directory, set up your project with composer:
composer init
  1. Then, make sure your new composer.json file contains the following options:
"minimum-stability": "dev",
"prefer-stable": true,
  1. Now, require Pest:
composer require pestphp/pest --dev
  1. Use the pest --init command to initialise your test environement:
./vendor/bin/pest --init

Under the hood, this Pest command will create the following:

  • a tests directory,
  • a phpunit.xml file,
  • a tests/Pest.php file,
  • a tests/Helpers.php file,
  • a tests/ExampleTest.php file,
  1. Finally, you can run Pest directly from the command line:


Happy Testing!

Next section: Creating Plugins →