Time Travel PHP Library

Travel is a small PHP library by Rachid Laasri that wraps around Carbon PHP to help you travel to a specific point in time and back again in a simple, readable way.Rachid Laasri@RashidLaasri

📣 Just released a small PHP package to help you work with dates in your tests.

🔗Check it out: https://github.com/rashidlaasri/travel …

View image on Twitter

The readme outlines the usage, which is designed to be simple and readable:

Travel::to('November 5, 1955');

// Stop Biff

// Get back to the future
Travel::to('October 26, 1985');

My favorite example is running some time-sensitive code in a closure, and then time goes back to the current date after the closure executes:

Travel::to('-5 minutes', function() {
    // Do something.

If you start time traveling, make sure you come back to avoid disrupting the time-space continuum:


You can learn more about this package, get full installation instructions, and view the source code on GitHub at rashidlaasri/travel.

Leave a Reply

Your email address will not be published. Required fields are marked *