A helper to control the flow of time
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
Carbon is an excellent library to work with time in PHP projects. The
Spatie\TestTime\TestTimeclass contains a few functions that under the hood manipulate the time that's considered the current time by Carbon.
// the flow of time is frozen TestTime::freeze();
// we're now one year in the future TestTime::addYear();
// will report the real current year + 1 $year = (new Carbon())->format('Y');
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
You can install the package via composer:
composer require spatie/test-time
You can freeze the time with:
Alternatively you can pass in a carbon instance that will be used as the current time.
You can also pass a format and time.
You can progress the time with any of the carbon functions starting with
// you can also chain calls TestTime::addMonth(3)->addYear();
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.
We publish all received postcards on our company website.
The MIT License (MIT). Please see License File for more information.