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 extension wrapper library.

v1.2.2(1mo ago)4183[2 issues](https://github.com/colopl/php-colopl_timeshifter/issues)[1 PRs](https://github.com/colopl/php-colopl_timeshifter/pulls)PHP-3.01CPHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.1 || ~8.5.0CI failing

Since Jul 1Pushed 1mo ago7 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 1mo ago

READMEChangelog (3)Dependencies (6)Versions (23)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`)
- `NOW()` and many statements in MySQL or compatible DBMS via PDO
- Server environment variables for request time (e.g. `S_SERVER['REQUEST_TIME']`)

Setup
-----

[](#setup)

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

And enable extension.

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

```

### PHP Library (recommended)

[](#php-library-recommended)

```
$ composer require --dev "colopl/colopl_timeshifter"
```

And use `Colopl\ColoplTimeShifter\Manager` class.

INI directives
--------------

[](#ini-directives)

#### `colopl_timeshifter.is_hook_pdo_mysql`

[](#colopl_timeshifteris_hook_pdo_mysql)

Type: `bool`Default: `true`Run-time switchable: **No** (`PHP_INI_SYSTEM`)

Enables or disables the hook into `\PDO::__construct` to swap the current time in MySQL function and keywords (e.g. `NOW()`, `CURRENT_TIMESTAMP`)

#### `colopl_timeshifter.is_hook_request_time`

[](#colopl_timeshifteris_hook_request_time)

Type: `bool`Default: `true`Run-time switchable: **No** (`PHP_INI_SYSTEM`)

Selects whether to hook the $\_SERVER superglobals `REQUEST_TIME` and `REQUEST_TIME_FLOAT`.

#### `colopl_timeshifter.usleep_sec`

[](#colopl_timeshifterusleep_sec)

Type: `int` (`int`) Defalt: `1`Run-time switchable: **Yes** (`PHP_INI_ALL`)

For a string representing time, set the number of wait microseconds to check whether it is absolute or relative time.

#### `colopl_timeshifter.is_restore_per_request`

[](#colopl_timeshifteris_restore_per_request)

Type: `bool`Default: `false`Run-time switchable: **Yes** (`PHP_INI_ALL`)

Sets whether or not to unhook at the end of the request.

Functions
---------

[](#functions)

Tip

Install `colopl/colopl_timeshifter` **Composer** package and use `Colopl\ColoplTimeShifter\Manager` support class instead.

#### `\Colopl\ColoplTimeShifter\register_hook(\DateInterval $interval): bool`

[](#coloplcolopltimeshifterregister_hookdateinterval-interval-bool)

Sets the time difference to be subtracted from the current time.

If the hook succeeds, it returns `true`; otherwise, it returns `false`.

#### `\Colopl\ColoplTimeShifter\unregister_hook(): void`

[](#coloplcolopltimeshifterunregister_hook-void)

Breaks the hook.

#### `\Colopl\ColoplTimeShifter\is_hooked(): bool`

[](#coloplcolopltimeshifteris_hooked-bool)

Check to see if the hook is done. Returns `true` if the hook is done, `false` otherwise.

License
-------

[](#license)

PHP License 3.01

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance82

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 72.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~52 days

Recently: every ~138 days

Total

13

Last Release

45d ago

PHP version history (3 changes)1.0.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0

1.1.7PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.1

v1.2.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.1 || ~8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec4f701f1c6b107218dbe17f7218ab1b9ff2889e7a543ab4065aba59786ac874?d=identicon)[COLOPL, Inc.](/maintainers/COLOPL,%20Inc.)

---

Top Contributors

[![zeriyoshi](https://avatars.githubusercontent.com/u/10289597?v=4)](https://github.com/zeriyoshi "zeriyoshi (51 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (14 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

extensionlibraryphpphp8

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/colopl-colopl-timeshifter/health.svg)

```
[![Health](https://phpackages.com/badges/colopl-colopl-timeshifter/health.svg)](https://phpackages.com/packages/colopl-colopl-timeshifter)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
