PHPackages                             stevebauman/laravel-husk - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. stevebauman/laravel-husk

ActiveLibrary[Testing &amp; Quality](/categories/testing)

stevebauman/laravel-husk
========================

A Laravel Dusk environment for your Javascript only applications.

v1.1.0(2y ago)89642MITPHPPHP ^8.0

Since Mar 19Pushed 2y ago3 watchersCompare

[ Source](https://github.com/stevebauman/laravel-husk)[ Packagist](https://packagist.org/packages/stevebauman/laravel-husk)[ RSS](/packages/stevebauman-laravel-husk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (7)Versions (4)Used By (0)

Laravel Husk
============

[](#laravel-husk)

Laravel Husk is a thin and light scaffolded Laravel Dusk environment.

It allows you to test your JavaScript applications with PHP using [Pest](https://pestphp.com), without having to scaffold an entire Laravel application.

Examples
--------

[](#examples)

JS FrameworkTests[NuxtJS](https://github.com/stevebauman/laravel-husk-nuxt)[![Nuxt Tests](https://github.com/stevebauman/laravel-husk-nuxt/actions/workflows/run-tests.yml/badge.svg)](https://github.com/stevebauman/laravel-husk-nuxt/actions/workflows/run-tests.yml/badge.svg)[NextJS](https://github.com/stevebauman/laravel-husk-next)[![Next Tests](https://github.com/stevebauman/laravel-husk-next/actions/workflows/run-tests.yml/badge.svg)](https://github.com/stevebauman/laravel-husk-next/actions/workflows/run-tests.yml/badge.svg)[Svelte](https://github.com/stevebauman/laravel-husk-svelte)[![Svelte Tests](https://github.com/stevebauman/laravel-husk-svelte/actions/workflows/run-tests.yml/badge.svg)](https://github.com/stevebauman/laravel-husk-svelte/actions/workflows/run-tests.yml/badge.svg)[Gatsby](https://github.com/stevebauman/laravel-husk-gatsby)[![Gatsby Tests](https://github.com/stevebauman/laravel-husk-gatsby/actions/workflows/run-tests.yml/badge.svg)](https://github.com/stevebauman/laravel-husk-gatsby/actions/workflows/run-tests.yml/badge.svg)[Gridsome](https://github.com/stevebauman/laravel-husk-gridsome)[![Gridsome Tests](https://github.com/stevebauman/laravel-husk-gridsome/actions/workflows/run-tests.yml/badge.svg)](https://github.com/stevebauman/laravel-husk-gridsome/actions/workflows/run-tests.yml/badge.svg)[Showcode (NuxtJS)](https://github.com/stevebauman/showcode)[![Gridsome Tests](https://github.com/stevebauman/showcode/actions/workflows/run-tests.yml/badge.svg)](https://github.com/stevebauman/showcode/actions/workflows/run-tests.yml/badge.svg)Installation
------------

[](#installation)

Inside of your JavaScript application folder, run the below command to scaffold the Laravel Husk environment:

> **Note**: This will create the folder named `browser` which will contain your Laravel Husk test environment.

```
composer create-project stevebauman/laravel-husk browser
```

After scaffolding the test environment, you should have the below folder structure;

```
javascript-app/
├── ...
└── browser/
    ├── bootstrap/
    ├── config/
    ├── storage/
    │   ├── log/
    │   ├── screenshots/
    │   └── source/
    └── tests/
        ├── ...
        ├── ExampleTest.php
        ├── DuskTestCase.php
        └── Pages/
            └── ExamplePage.php

```

Then, navigate into the `browser` directory and install the Chrome driver by running the below command:

```
php application dusk:chrome-driver --detect

```

Usage
-----

[](#usage)

Before running your dusk tests, be sure to set the proper base URL to where your JavaScript application will be served from:

```
// tests/DuskTestCase.php

protected function setUp(): void
{
    parent::setUp();

    $this->setupBrowser('http://localhost:3000');
}
```

After setting the base URL, serve your JavaScript application:

```
npm run dev
```

Then, inside of another terminal, navigate into the `browser` directory:

```
cd browser
```

And run the below command:

> **Important**: Make sure you've installed the Chrome driver first, via `php application dusk:chrome-driver --detect`

```
php application pest:dusk
```

With arguments:

```
php application pest:dusk --order-by=random --filter="it can load"
```

> **Note**: You may also insert the below JSON into the `scripts` section of your `package.json` file to run your browser tests from your root project directory:
>
> ```
> "scripts": {
>     "test": "cd browser && php application pest:dusk"
> }
> ```
>
>
>
> ```
> npm run test
> ```

GitHub Actions
--------------

[](#github-actions)

You may use the below GitHub action as a template to run your Laravel Dusk tests:

```
name: run-tests

on:
    push:
    pull_request:
    schedule:
        - cron: "0 0 * * *"

jobs:
    run-tests:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2
            - uses: actions/setup-node@v2
              with:
                  cache: "npm"

            - name: Install Javascript Dependencies
              run: npm install

            - name: Start JavaScript Application
              run: npm run dev &

            - name: Install Composer Dependencies
              working-directory: ./browser
              run: composer install --no-progress --prefer-dist --optimize-autoloader

            - name: Upgrade Chrome Driver
              working-directory: ./browser
              run: php application dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`

            - name: Run Dusk Tests
              working-directory: ./browser
              run: php application pest:dusk

            - name: Upload Screenshots
              if: failure()
              uses: actions/upload-artifact@v2
              with:
                  name: screenshots
                  path: browser/storage/screenshots

            - name: Upload Console Logs
              if: failure()
              uses: actions/upload-artifact@v2
              with:
                  name: console
                  path: browser/storage/console
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.5% 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

988d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6dd082636ff8a08df8dfdcd622ea242374d1d76dd33bceec5a6cd3ae26dc24f?d=identicon)[stevebauman](/maintainers/stevebauman)

---

Top Contributors

[![stevebauman](https://avatars.githubusercontent.com/u/6421846?v=4)](https://github.com/stevebauman "stevebauman (45 commits)")[![alexmanase](https://avatars.githubusercontent.com/u/10696975?v=4)](https://github.com/alexmanase "alexmanase (7 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/stevebauman-laravel-husk/health.svg)

```
[![Health](https://phpackages.com/badges/stevebauman-laravel-husk/health.svg)](https://phpackages.com/packages/stevebauman-laravel-husk)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[pdepend/pdepend

Official version of pdepend to be handled with Composer

954110.9M815](/packages/pdepend-pdepend)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

78268.9M1.5k](/packages/phpstan-phpstan-symfony)

PHPackages © 2026

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