rachidlaasri/travel

Framework agnostic PHP package to control the time.


Keywords
time, travel, carbon
License
MIT

Documentation

rashidlaasri travel

StyleCI License Travis Ci build Latest Version on Packagist Total Downloads

Travel is a framework agnostic wrapper around Carbon, it helps you travel to a certain date and travel back to today's date in a readable way.

Installation

You can install the package via composer:

composer require rachidlaasri/travel

Usage

Travel to a certain date with:

// Jump to 2009 and watch the last Michael Jackson live performance.
Travel::to('01-01-2009');

Travel to a given date, excute a piece of code and reset:

// Travel to the past and un-say that embarassing thing you said and come back.
Travel::to('-5 minutes', function() {
    // Do something.
});

Reset the date to today's date

Travel::back();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.