PHPackages                             manyapp/duskapiconf - 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. manyapp/duskapiconf

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

manyapp/duskapiconf
===================

Change your Laravel configuration for each Dusk test with an easy API

v0.0.3(6y ago)110.0k3mitPHP

Since Jul 4Pushed 3y agoCompare

[ Source](https://github.com/manyapp/duskapiconf)[ Packagist](https://packagist.org/packages/manyapp/duskapiconf)[ RSS](/packages/manyapp-duskapiconf/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (4)Used By (0)

[![Manyapp DuskApiConf](https://camo.githubusercontent.com/330dd735bab560551b4c6514a2642785f34ce93e379e28ba1f6790202b2a4d35/68747470733a2f2f6d616e792e6170702f77702d636f6e74656e742f75706c6f6164732f323031392f30372f6d616e796170705f6475736b617069636f6e662e706e67)](https://camo.githubusercontent.com/330dd735bab560551b4c6514a2642785f34ce93e379e28ba1f6790202b2a4d35/68747470733a2f2f6d616e792e6170702f77702d636f6e74656e742f75706c6f6164732f323031392f30372f6d616e796170705f6475736b617069636f6e662e706e67)

**A Laravel module to perform live configuration changes from your Dusk tests**

The issue
---------

[](#the-issue)

Currently, the only way to define the configuration of your Laravel app during Dusk tests is to set the relevant variables in a dedicated `.env.dusk.local` file. This file is copied and read during the application's boot, and therefore cannot be changed within Dusk tests.

This behaviour can be problematic, as a lot of developers need to change the configuration in specific tests to see if the application reacts accordingly.

As mentionned [here](https://github.com/laravel/dusk/issues/599), there is no easy way to tackle this problem.

The solution
------------

[](#the-solution)

This modules offers an easy possibility to change the configuration of your application during the runtime of your Dusk tests.

See how it works on our [blog article](https://many.app/changing-laravel-configuration-during-dusk-tests/).

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

[](#installation)

Install the module with:

```
composer require manyapp/duskapiconf --dev

```

Then, you will have to modify your `DustTestCase.php` to add three methods. Alternatively, you can add the following methods to the Trait of your choice and use the Trait in your Dusk tests.

```
/**
* Set live config option
*
* @param string $key
* @param mixed $value
* @return void
*/
public function setConfig($key, $value)
{
    $encoded = base64_encode(json_encode($value));
    $query = "?key=".$key.'&value='.$encoded;
    $this->browse(function($browser) use ($query) {
        $data = $browser->visit('/duskapiconf/set'.$query)->element('.content')->getAttribute('innerHTML');
        $data = trim($data);
        if ($data !== 'ok') {
            $this->assertTrue(false);
        }
    });
}

/**
* Get a current configuration item
*
* @param string $key
* @return mixed
*/
public function getConfig($key)
{
    $query = "?key=".$key;
    $result = null;
    $this->browse(function($browser) use ($query, &$result) {
        $data = $browser->visit('/duskapiconf/get'.$query)->element('.content')->getAttribute('innerHTML');
        $result = json_decode(base64_decode($data), true);
    });
    return $result;
}

/**
* Reset the configuration to its initial status
*
* @return void
*/
public function resetConfig()
{
    $this->browse(function($browser) {
        $browser->visit('/duskapiconf/reset');
    });
}

```

Usage
-----

[](#usage)

To use it, use the defined methods below directly in your Dusk tests.

```
/** @test */
public function your_dusk_test()
{
    // Get a config variable
    // Here, $appName will be "Laravel" on a fresh install
    $appName = $this->getConfig('app.name');

    // Change a config variable
    $this->setConfig('app.name', 'Laravel is fantastic');

    // Here, $appName will be Laravel is fantastic
    $appName = $this->getConfig('app.name');

    // Your tests with assertions

    // You can reset all config variables set before.
    // This is not mandatory: you can keep the variables set for the next test if you want.
    $this->resetConfig();
}

```

Change location of the config temporary file
--------------------------------------------

[](#change-location-of-the-config-temporary-file)

Type the following commands:

```
php artisan vendor:publish --provider="Manyapp\DuskApiConf\DuskApiConfServiceProvider"

```

Modify the Storage disk and the name of the temporary file.

Contribute
----------

[](#contribute)

For any bug or feature request, use Github.

For any other feedback, let us a comment on this [blog article](https://many.app/changing-laravel-configuration-during-dusk-tests/) or [contact us](https://many.app/contact/).

License
-------

[](#license)

MIT.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

3

Last Release

2501d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b1d5189fa56fd2e4bcb0e0762ae6ff40c98c43ba3bff8e3734b0443fa8bb5ea?d=identicon)[ManyApp](/maintainers/ManyApp)

---

Top Contributors

[![manyapp](https://avatars.githubusercontent.com/u/52505984?v=4)](https://github.com/manyapp "manyapp (5 commits)")

### Embed Badge

![Health badge](/badges/manyapp-duskapiconf/health.svg)

```
[![Health](https://phpackages.com/badges/manyapp-duskapiconf/health.svg)](https://phpackages.com/packages/manyapp-duskapiconf)
```

###  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)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M571](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

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

PHPackages © 2026

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