1. RequirementsPHP: Version 8.3 or higher.Laravel: Version 12.2.
Installation Steps
Run the following commands in your terminal from the root of your project:
Install Pest and the Laravel Plugin:
bash
composer require pestphp/pest --dev --with-all-dependenciescomposer require pestphp/pest-plugin-laravel --dev
Use code with caution.Note: You may be prompted to remove phpunit/phpunit.
You can safely do so as Pest is built on top of PHPUnit and will handle your existing tests.
Initialize Pest:
Run the artisan command to create the necessary configuration files (like tests/Pest.php):
bash
php artisan pest:install
Use code with caution.If that command is not available, you can use the direct vendor binary:
bash
./vendor/bin/pest --init
Use code with caution.Verify the Installation:Run your tests to ensure everything is working correctly:
bash
php artisan test
Use code with caution.Alternatively, you can use the Pest binary directly:
./vendor/bin/pest.