Load your own time in order to simulate the current date and time.
composer require axiocode/mynow
Create the .time
file in your directory with the timestamp of desired date and time.
245671200
You can then load .time
in your application with:
$mynow = MyNow\MyNow::create(__DIR__);
Replace all calls to the default DateTime() constructor by MyNow DateTime.
$now = MyNow\DateTime();
If MyNow is not used or no file exists, the default DateTime instance will be used without to break your code.
Currently only text loader is supported.
Different loaders may be provided to load date/time from different sources such as a database, YAML, etc.
MyNow is licensed under The BSD 3-Clause License.