PHPackages                             icanhazstring/symfony-time-machine - 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. icanhazstring/symfony-time-machine

ActiveSymfony-bundle

icanhazstring/symfony-time-machine
==================================

Symfony bundle that adds the capability to change the datetime of an application

0.1.1(3y ago)71.5k[1 issues](https://github.com/icanhazstring/symfony-time-machine/issues)[8 PRs](https://github.com/icanhazstring/symfony-time-machine/pulls)MITPHPPHP ^8.1

Since Oct 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/icanhazstring/symfony-time-machine)[ Packagist](https://packagist.org/packages/icanhazstring/symfony-time-machine)[ Docs](https://github.com/icanhazstring/symfony-time-machine)[ GitHub Sponsors](https://github.com/sponsors/icanhazstring)[ Fund](https://paypal.me/icanhazstring)[ RSS](/packages/icanhazstring-symfony-time-machine/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (10)Versions (11)Used By (0)

symfony-time-machine
====================

[](#symfony-time-machine)

Symfony bundle that adds the capability to change the datetime of an application

Motivation
----------

[](#motivation)

Writing tests for your application is somewhat nice and easy. But what about testing your application that heavily is based upon `DateTime` objects?

There is `symfony/clock` which already provides a `ClockInterface` which you can use to inject a `NativeClock` or `MockClock` into your services.

But that only works for tests. What if you want to test end-to-end? You could change the system time of you server, true, but there is an easier way using this `symfony-time-machine`.

Installation
------------

[](#installation)

```
composer require icanhazstring/symfony-time-machine

```

If the autoregister doesn't work, add the bundle into your `config/bundles.php`.

```
