kolemp / timecop-bundle
Easy symfony integration with https://github.com/hnw/php-timecop
Installs: 59 975
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 1
Open Issues: 0
Type:symfony-bundle
pkg:composer/kolemp/timecop-bundle
This package is not auto-updated.
Last update: 2025-12-07 02:50:08 UTC
README
This is a very tiny symfony (2&3) bundle that simplifies usage of php-timecop. To use this extension you need a php server with configured timecop.so extension. In case of troubles with compilation I can provide some extra instructions.
Warning!
Using this extension same as php-timecop alone can be very dangerous especially on production environment. Use it wisely.
Installation
composer require kolemp/timecop-bundle
Configuration
After installation add the bundle to app/AppKernel.php. By default the extension is disabled. To enable it add a section to config.yml for environments you want it to be enabled:
kolemp_timecop: enabled: true
Time sources
You can set the time by query parameter or the cookie. Both are named fakeTime. The value given must be compatibile with relative date formats.
Example url: example.com?fakeTime=+3 days
Disabling time source
You can disable any of time sources in config. By default all are enabled:
kolemp_timecop: queryParameter: true cookie: true header: true
Source order
The time data is used in the following order: the header, the cookie, the query parameter.