PHPackages                             colopl/colopl\_timeshifter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. colopl/colopl\_timeshifter

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

colopl/colopl\_timeshifter
==========================

Current time modification PHP extension.

v2.0.0(1mo ago)4193[1 issues](https://github.com/colopl/php-colopl_timeshifter/issues)[4 PRs](https://github.com/colopl/php-colopl_timeshifter/pulls)BSD-3-ClausePHPPHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.1 || ~8.5.0CI passing

Since Jul 1Pushed yesterday7 watchersCompare

[ Source](https://github.com/colopl/php-colopl_timeshifter)[ Packagist](https://packagist.org/packages/colopl/colopl_timeshifter)[ RSS](/packages/colopl-colopl-timeshifter/feed)WikiDiscussions main Synced yesterday

READMEChangelog (5)Dependencies (9)Versions (29)Used By (0)

colopl\_timeshifter
===================

[](#colopl_timeshifter)

This extension changes the current time in PHP to a specified modified value.

Warning

**DO NOT USE THIS EXTENSION IN ANY PRODUCTION ENVIRONMENT!!!**

At present, this extension is effective for the following functions:

- Any built-in PHP processing that handles the current time (`ext-date`, `ext-calendar`)
- `NOW()` and many statements in MySQL or compatible DBMS via PDO
- Server environment variables for request time (e.g. `$_SERVER['REQUEST_TIME']`)

Install
-------

[](#install)

Clone the repository with submodules and build the extension.

```
$ git clone --recursive "https://github.com/colopl/php-colopl_timeshifter.git" "colopl_timeshifter"
$ cd "colopl_timeshifter/ext"
$ phpize
$ ./configure --with-php-config="$(which php-config)"
$ make -j"$(nproc)"
$ TEST_PHP_ARGS="--show-diff -q" make test
$ sudo make install
```

Enable the extension after installation.

```
$ echo "extension=colopl_timeshifter" | sudo tee "$(php-config --ini-dir)/99-colopl_timeshifter.ini"
$ php -m | grep "colopl_timeshifter"
colopl_timeshifter
```

Build Ubuntu packages
---------------------

[](#build-ubuntu-packages)

Ubuntu packages are built with standard Debian packaging via `dpkg-buildpackage`, not `checkinstall`. The packaging definitions live alongside each build target under `build/*/debian`.

Build packages for the official Ubuntu 22.04 PHP 8.1 stack:

```
$ docker build -f "build/ubuntu2204/Dockerfile" -t "colopl-timeshifter-u2204-php81" .
$ mkdir -p "artifacts"
$ docker run --rm -e VERSION="x.y.z" -v "$(pwd)/artifacts:/tmp/artifacts" "colopl-timeshifter-u2204-php81"
```

This target produces `php8.1-colopl-timeshifter_x.y.z__ubuntu22.04_default.deb`.

Build packages for Ubuntu 22.04 with the Ondrej Sury PHP 8.4 repository:

```
$ docker build -f "build/ubuntu2204_sury84/Dockerfile" -t "colopl-timeshifter-u2204-sury84-php84" .
$ mkdir -p "artifacts"
$ docker run --rm -e VERSION="x.y.z" -v "$(pwd)/artifacts:/tmp/artifacts" "colopl-timeshifter-u2204-sury84-php84"
```

This target produces `php8.4-colopl-timeshifter_x.y.z__ubuntu22.04_sury.deb`.

Build packages for the official Ubuntu 26.04 PHP 8.5 stack:

```
$ docker build -f "build/ubuntu2604/Dockerfile" -t "colopl-timeshifter-u2604-php85" .
$ mkdir -p "artifacts"
$ docker run --rm -e VERSION="x.y.z" -v "$(pwd)/artifacts:/tmp/artifacts" "colopl-timeshifter-u2604-php85"
```

This target produces `php8.5-colopl-timeshifter_x.y.z__ubuntu26.04_default.deb`.

Generated `.ddeb`, `.changes`, and `.buildinfo` artifacts use the same Ubuntu version and PHP variant suffix when present.

Migration Guide
---------------

[](#migration-guide)

### From Composer Package to Packagist PHP Extension Installer

[](#from-composer-package-to-packagist-php-extension-installer)

As of version 2.0, this package is distributed as a PHP extension via the Packagist PHP Extension installer (PIE), not as a Composer library package. The former PHP wrapper interface (`Colopl\ColoplTimeShifter\Manager`) is now implemented by the extension itself.

#### For users previously using `Manager` class

[](#for-users-previously-using-manager-class)

**Before (version &lt; 2.0):**

```
