In this section, we will discuss the official and community developed plugins that we endorse. Plugins primarily offer namespaced functions, console commands, custom expectations, and additional command-line options to augment the default Pest experience.

If you are a plugin developer, please consult our documentation on creating plugins for more information on how to create Pest plugins.

The following plugins are maintained by the Pest team:


Source code:

To start using Pest's Faker plugin, you need to require the plugin via Composer.

1composer require pestphp/pest-plugin-faker --dev

After installing the plugin, you may utilize the namespaced fake function to generate fake data for your tests.

1use function Pest\Faker\fake;
3it('generates a name', function () {
4 $name = fake()->name; // random name...
6 //

You can also designate the "locale" that should be utilized by the fake() function by providing the locale to the function.

1use function Pest\Faker\fake;
3it('generates a portuguese name', function () {
4 $name = fake('pt_PT')->name; // Nuno Maduro
6 //

To learn more about Faker, including comprehensive details about the API it provides, please consult its official documentation.


Source code:

To start using Pest's Laravel plugin, you need to require this plugin via Composer.

1composer require pestphp/pest-plugin-laravel --dev

This plugin adds additional Artisan commands and functions to the default Pest installation. For example, to generate a new test in the tests/Feature directory, you can now utilize the pest:test Artisan command.

1php artisan pest:test UsersTest

You may provide the --unit option when creating a test to place the test in the tests/Unit directory.

1php artisan pest:test UsersTest --unit

Executing the pest:dataset Artisan command will create a fresh dataset in the tests/Datasets directory.

1php artisan pest:dataset Emails

As you may know, Laravel provides a variety of assertions you can take advantage of in your feature tests. When using Pest's Laravel plugin, you may access all of those assertions as you typically would.

1it('has a welcome page', function () {
2 $this->get('/')->assertStatus(200);

In addition, with the assistance of this plugin, it is possible for you to bypass the $this variable while using namespaced functions such as actingAs, get, post and delete.

1use function Pest\Laravel\{get};
3it('has a welcome page', function () {
4 get('/')->assertStatus(200);
5 // same as $this->get('/')...

To illustrate this convenient feature using another example, we can write a test acting as an authenticated user accessing the restricted dashboard page.

1use App\Models\User;
2use function Pest\Laravel\{actingAs};
4test('authenticated user can access the dashboard', function () {
5 $user = User::factory()->create();
7 actingAs($user)->get('/dashboard')
8 ->assertStatus(200);

As you may expect, all of the assertions that were previously accessible via $this-> are available as namespace functions.

1use function Pest\Laravel\{actingAs, get, post, delete, ...};

You can find the full testing documentation on the Laravel website:


Source code:

To install Pest's Livewire plugin, you need to require the plugin via Composer.

1composer require pestphp/pest-plugin-livewire --dev

After installing the plugin, you may use the livewire namespaced function to access your Livewire components.

1use function Pest\Livewire\livewire;
3it('can be incremented', function () {
4 livewire(Counter::class)
5 ->call('increment')
6 ->assertSee(1);
9it('can be decremented', function () {
10 livewire(Counter::class)
11 ->call('decrement')
12 ->assertSee(-1);


Source code:

To install Pest's "watch" plugin, you need to require the plugin via Composer.

1composer require pestphp/pest-plugin-watch --dev

Make sure you also install fswatch so Pest can monitor when a file changes.

Once both the plugin and fswatch are installed, you will be able to use the --watch option when running Pest. This option instructs Pest to monitor your application and automatically re-run your tests when you change files within a list of specified directories.

1pest --watch

By default, the plugin monitors the following directories.


To customize the watched directories, supply a comma-separated list of directories (relative to your application root) to the --watch flag.

1pest --watch=app,routes,tests

In this section, we have seen how plugins can enhance your Pest experience. Now, let's dive into architectural testing and how it can benefit your development process. By performing architectural testing, you can evaluate the overall design of your application and identify potential flaws before they become significant issues: Arch Testing