PHPackages                             lukeraymonddowning/pest-plugin-larastrap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. lukeraymonddowning/pest-plugin-larastrap

ActiveLibrary[Framework](/categories/framework)

lukeraymonddowning/pest-plugin-larastrap
========================================

My awesome plugin

v0.3.0(3y ago)937.5k↓46.3%2[3 issues](https://github.com/lukeraymonddowning/pest-plugin-larastrap/issues)MITPHPPHP ^8.1 || ^8.2

Since Oct 17Pushed 3y agoCompare

[ Source](https://github.com/lukeraymonddowning/pest-plugin-larastrap)[ Packagist](https://packagist.org/packages/lukeraymonddowning/pest-plugin-larastrap)[ GitHub Sponsors](https://github.com/lukeraymonddowning)[ RSS](/packages/lukeraymonddowning-pest-plugin-larastrap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (5)Used By (0)

Pest Larastrap Plugin
=====================

[](#pest-larastrap-plugin)

> This is currently a highly experimental project and is subject to large pre-release changes.

[Pest PHP](https://pestphp.com) is an awesome PHP testing framework. It already has amazing support for Laravel via the [Laravel plugin](https://pestphp.com/docs/plugins/laravel)! Occasionally however, you'll come across some quirks when working with Pest and Laravel due to the fact that Laravel hasn't been booted during the Pest compile stage. Take a look at the following example, using [Higher Order Tests](https://pestphp.com/docs/higher-order-tests):

```
it('points to the correct URL')
    ->expect(route('dashboard'))
    ->toBe(config('app.url').'/dashboard');
```

If you try to run this out of the box, it will fail; we're trying to make use of Laravel's `route` and `config` helpers, but they require the Laravel application to be booted.

Enter Larastrap. After installing this plugin, the above test will run without issue, and you can carry on testing without any headaches!

Installation
------------

[](#installation)

You can install Larastrap via composer:

```
composer require --dev lukeraymonddowning/pest-plugin-larastrap
```

It will be automatically registered, so you can start using it right away!

Prerequisites
-------------

[](#prerequisites)

The only prerequisite for using Larastrap is having a `CreatesApplication` trait in your application's `tests` folder. You almost certainly already have this, as it ships out of the box with Laravel. This trait should have a `createApplication` method inside it. If you don't know what we're talking about, it likely means everything is good to go and you can skip this section.

Common use cases
----------------

[](#common-use-cases)

We've already highlighted that Larastrap is super useful in higher order tests.

```
it('can access the dashboard')
    ->get(route('dashboard'))
    ->assertOk();
```

Somewhere else it comes in handy is datasets. Traditionally, you wouldn't be able to make use of Laravel in your datasets. With Larastrap, however, you have the full power of Laravel at your fingertips. For example, perhaps you want to check that all service providers are present in your `app.php` config file:

```
dataset('laravel service providers', function () {
    yield from config('app.providers');
});
```

Now, we have access to a dynamically updated array of provider strings that we can make use of in any test.

Perhaps we want a dataset of the middleware registered on a certain route:

```
dataset('admin panel middleware', function () {
    return Route::gatherRouteMiddleware(Route::getRoutes()->getByName('admin.dashboard')));
});
```

You can see how powerful this concept is; it opens up the possibility of completely dynamic datasets that grow with your application automatically.

Caveats
-------

[](#caveats)

There are a few caveats and limitations you should be aware of when using Larastrap:

### You shouldn't use the database outside of the test

[](#you-shouldnt-use-the-database-outside-of-the-test)

Because Larastrap is basically booting its own laravel instance prior to any of your tests running, the database will be reset before your test is run. As such, you should still perform database queries inside each test.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~264 days

Total

3

Last Release

1147d ago

PHP version history (3 changes)v0.1.0PHP ^7.3 || ^8.0

v0.2.0PHP ^7.4 || ^8.0 || ^8.1

v0.3.0PHP ^8.1 || ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/139db346fa173a79481af05b0455e2e8ad7d2ab594c7f53bde3522a3dfeeaf25?d=identicon)[96downlu](/maintainers/96downlu)

---

Top Contributors

[![lukeraymonddowning](https://avatars.githubusercontent.com/u/12202279?v=4)](https://github.com/lukeraymonddowning "lukeraymonddowning (23 commits)")[![pedrogxv](https://avatars.githubusercontent.com/u/63373521?v=4)](https://github.com/pedrogxv "pedrogxv (8 commits)")[![thinkverse](https://avatars.githubusercontent.com/u/2221746?v=4)](https://github.com/thinkverse "thinkverse (2 commits)")

---

Tags

phpplugintestingunitframeworktestpest

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/lukeraymonddowning-pest-plugin-larastrap/health.svg)

```
[![Health](https://phpackages.com/badges/lukeraymonddowning-pest-plugin-larastrap/health.svg)](https://phpackages.com/packages/lukeraymonddowning-pest-plugin-larastrap)
```

###  Alternatives

[pestphp/pest-plugin-profanity

The Pest Profanity Plugin

1048.8M28](/packages/pestphp-pest-plugin-profanity)[pestphp/pest-plugin-arch

The Arch plugin for Pest PHP.

4145.8M4.0k](/packages/pestphp-pest-plugin-arch)[defstudio/pest-plugin-laravel-expectations

A plugin to add laravel tailored expectations to Pest

98548.9k4](/packages/defstudio-pest-plugin-laravel-expectations)[pestphp/pest-plugin-type-coverage

The Type Coverage plugin for Pest PHP.

343.3M732](/packages/pestphp-pest-plugin-type-coverage)[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67792.6k16](/packages/pestphp-pest-plugin-stressless)[pestphp/pest-plugin-parallel

The Pest Parallel Plugin

313.5M107](/packages/pestphp-pest-plugin-parallel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
