PHPackages                             symfony/clock - 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. symfony/clock

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

symfony/clock
=============

Decouples applications from the system clock

v8.1.0(1w ago)432192.7M↓16.6%320MITPHPPHP &gt;=8.4.1

Since Oct 17Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/symfony/clock)[ Packagist](https://packagist.org/packages/symfony/clock)[ Docs](https://symfony.com)[ Fund](https://symfony.com/sponsor)[ GitHub Sponsors](https://github.com/fabpot)[ RSS](/packages/symfony-clock/feed)WikiDiscussions 8.1 Synced 1w ago

READMEChangelog (10)Dependencies (3)Versions (69)Used By (20)

Clock Component
===============

[](#clock-component)

Symfony Clock decouples applications from the system clock.

Getting Started
---------------

[](#getting-started)

```
composer require symfony/clock
```

```
use Symfony\Component\Clock\NativeClock;
use Symfony\Component\Clock\ClockInterface;

class MyClockSensitiveClass
{
    public function __construct(
        private ClockInterface $clock,
    ) {
        // Only if you need to force a timezone:
        //$this->clock = $clock->withTimeZone('UTC');
    }

    public function doSomething()
    {
        $now = $this->clock->now();
        // [...] do something with $now, which is a \DateTimeImmutable object

        $this->clock->sleep(2.5); // Pause execution for 2.5 seconds
    }
}

$clock = new NativeClock();
$service = new MyClockSensitiveClass($clock);
$service->doSomething();
```

Resources
---------

[](#resources)

- [Documentation](https://symfony.com/doc/current/components/clock.html)
- [Contributing](https://symfony.com/doc/current/contributing/index.html)
- [Report issues](https://github.com/symfony/symfony/issues) and [send Pull Requests](https://github.com/symfony/symfony/pulls)in the [main Symfony repository](https://github.com/symfony/symfony)

###  Health Score

75

—

ExcellentBetter than 100% of packages

Maintenance95

Actively maintained with recent releases

Popularity71

Solid adoption and visibility

Community41

Growing community involvement

Maturity79

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~19 days

Recently: every ~10 days

Total

69

Last Release

12d ago

Major Versions

v7.4.0-BETA1 → v8.0.0-BETA12025-08-04

v6.4.30 → 7.3.x-dev2025-11-12

v7.4.0-RC1 → v8.0.02025-11-12

v7.4.8 → v8.0.82026-03-30

7.4.x-dev → 8.0.x-dev2026-04-18

PHP version history (4 changes)v6.2.0-BETA1PHP &gt;=8.1

v7.0.0-BETA1PHP &gt;=8.2

v8.0.0-BETA1PHP &gt;=8.4

v8.1.0-BETA1PHP &gt;=8.4.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47313?v=4)[Fabien Potencier](/maintainers/fabpot)[@fabpot](https://github.com/fabpot)

---

Top Contributors

[![nicolas-grekas](https://avatars.githubusercontent.com/u/243674?v=4)](https://github.com/nicolas-grekas "nicolas-grekas (45 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (15 commits)")[![fabpot](https://avatars.githubusercontent.com/u/47313?v=4)](https://github.com/fabpot "fabpot (11 commits)")[![derrabus](https://avatars.githubusercontent.com/u/1506493?v=4)](https://github.com/derrabus "derrabus (6 commits)")[![wouterj](https://avatars.githubusercontent.com/u/749025?v=4)](https://github.com/wouterj "wouterj (3 commits)")[![yoeunes](https://avatars.githubusercontent.com/u/10859693?v=4)](https://github.com/yoeunes "yoeunes (2 commits)")[![ruudk](https://avatars.githubusercontent.com/u/104180?v=4)](https://github.com/ruudk "ruudk (2 commits)")[![HypeMC](https://avatars.githubusercontent.com/u/2445045?v=4)](https://github.com/HypeMC "HypeMC (1 commits)")[![PhilETaylor](https://avatars.githubusercontent.com/u/400092?v=4)](https://github.com/PhilETaylor "PhilETaylor (1 commits)")[![bonroyage](https://avatars.githubusercontent.com/u/4411748?v=4)](https://github.com/bonroyage "bonroyage (1 commits)")[![upyx](https://avatars.githubusercontent.com/u/6064612?v=4)](https://github.com/upyx "upyx (1 commits)")[![victor-prdh](https://avatars.githubusercontent.com/u/61290725?v=4)](https://github.com/victor-prdh "victor-prdh (1 commits)")[![fancyweb](https://avatars.githubusercontent.com/u/3658119?v=4)](https://github.com/fancyweb "fancyweb (1 commits)")[![EJTJ3](https://avatars.githubusercontent.com/u/31619091?v=4)](https://github.com/EJTJ3 "EJTJ3 (1 commits)")[![keradus](https://avatars.githubusercontent.com/u/2716794?v=4)](https://github.com/keradus "keradus (1 commits)")

---

Tags

clockcomponentphppsr20symfonysymfony-componenttimeclockpsr20time

### Embed Badge

![Health badge](/badges/symfony-clock/health.svg)

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

###  Alternatives

[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k41](/packages/ecotone-ecotone)[beste/clock

A collection of Clock implementations

7426.0M26](/packages/beste-clock)[icecave/chrono

A date &amp; time library that is decoupled from the system clock.

56193.6k7](/packages/icecave-chrono)

PHPackages © 2026

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