PHPackages                             paksuco/dusk-time-travel - 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. paksuco/dusk-time-travel

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

paksuco/dusk-time-travel
========================

A dusk browser extension package for time traveling

0.0.4(5mo ago)32284MITPHPCI failing

Since Dec 20Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/paksuco/dusk-time-travel)[ Packagist](https://packagist.org/packages/paksuco/dusk-time-travel)[ Docs](https://github.com/paksuco/dusk-time-travel)[ GitHub Sponsors](https://github.com/sponsors/tpaksu)[ RSS](/packages/paksuco-dusk-time-travel/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (9)Versions (6)Used By (0)

[![](.github/dusk-time-travel.png)](.github/dusk-time-travel.png)

A dusk browser extension package for time traveling
---------------------------------------------------

[](#a-dusk-browser-extension-package-for-time-traveling)

[![Latest Version on Packagist](https://camo.githubusercontent.com/dbaa9c06b9faec07feaebc5672b673f750a45c7f0ae151de9dcacc31ea960aa2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70616b7375636f2f6475736b2d74696d652d74726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/paksuco/dusk-time-travel)[![Total Downloads](https://camo.githubusercontent.com/552848bd3b721416a8261a9acff4f721372bcd0d542f690df61eb3909c651692/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70616b7375636f2f6475736b2d74696d652d74726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/paksuco/dusk-time-travel)

This package feeds the hunger for Dusk test cases having time modified requests. All PR's are welcome.

Supported versions:

- Laravel Dusk 6 → 8
- Laravel Framework 7 → 12
- PHP 7.4 → 8.5

Beyond this the package may continue to work, but is untested. Please raise an issue if you run into problems, so it can be fixed.

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

[](#installation)

You can install the package via composer:

```
composer require paksuco/dusk-time-travel
```

There is a crucial step to do after installing the package to let the browser have time travel methods, you need to extend your browser class from `Paksuco/DuskTimeTravel/Browser` class instead of the stock `Laravel/Dusk/Browser`. This class acts like a middle man between your test cases and the Laravel Dusk browser.

To do this, add this code to your `DuskTestCase.php` file:

```
    use \Paksuco\DuskTimeTravel\Browser as TimeTravelBrowser;

    class DuskTestCase extends BaseTestCase {

        protected function newBrowser($driver)
        {
            return new TimeTravelBrowser($driver);
        }

    }
```

Usage
-----

[](#usage)

Since you've changed your browser class, you've gained access to two new Dusk browser methods:

- `travelTo($time)` - travel through time, using a `Illuminate/Support/Carbon` instance as the time input.
- `travelBack()` - return to the current time.

**Note**: As the package uses cookies to deliver the modified time to the browser, only the next requests will use the changed time, the current page won't have the date modified. For logging in, this means that may need to change the time and *then* load the login page.

For example:

```
$this->browse(function ($browser) {

    // The home page will show today's date
    $browser->visit("home")
        ->travelTo(Carbon::tomorrow());
});
```

```
$this->browse(function ($browser) {

    // The home page will show tomorrow's date
    $browser->travelTo(Carbon::tomorrow())
        ->visit("home");
});
```

Both of them will use tomorrows date as the next request (AJAX or Redirect, doesn't matter).

Other usage examples:

```
$this->browse(function ($browser) {

    // Do something in yesterdays date and expect to see that it occurred on that date
    $browser->travelTo(Carbon::yesterday())->visit($itemDetailsPage)
        ->doStuffInYesterdaysDate()
        ->travelBack()->visit($itemDetailsPage)
        ->assertSee(Carbon::yesterday());
});
```

```
$this->browse(function ($browser) {

    // Log in sometime in the distant future (long after session expiry)
    $user = User::factory()->create(['name' => 'Bob']);
    $browser->visit('/')
        ->travelTo(Carbon::parse('2040-01-01 12:00:00')
        ->actingAs($user)->visit('/dashboard')
        ->assertSee("Welcome Bob, it is the year 2040!");
});
```

After you've recreated the instance, or manually reset with `travelBack()`, the server will revert to the normal date.

Testing
-------

[](#testing)

A test case is included, but since it's a Dusk extension, the tests are run on a Laravel instance having Dusk installed. You can test the plugin the same way the `.github/workflows/run-tests.yml` workflow does.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Taha Paksu](https://github.com/tpaksu)
- [Shane Smith](https://github.com/shane-smith)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance73

Regular maintenance activity

Popularity17

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.4% 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 ~601 days

Total

4

Last Release

164d ago

### Community

Maintainers

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

---

Top Contributors

[![tpaksu](https://avatars.githubusercontent.com/u/3295?v=4)](https://github.com/tpaksu "tpaksu (53 commits)")[![shane-smith](https://avatars.githubusercontent.com/u/943942?v=4)](https://github.com/shane-smith "shane-smith (4 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (1 commits)")

---

Tags

browserdusklaravellaravel-dusklaravel-dusk-cilaravel-packagetestingtime-travelpaksucodusk-time-travel

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/paksuco-dusk-time-travel/health.svg)

```
[![Health](https://phpackages.com/badges/paksuco-dusk-time-travel/health.svg)](https://phpackages.com/packages/paksuco-dusk-time-travel)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[illuminate/routing

The Illuminate Routing package.

1238.6M2.3k](/packages/illuminate-routing)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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