PHPackages                             igor-popravka/ip-time-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. igor-popravka/ip-time-clock

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

igor-popravka/ip-time-clock
===========================

PSR-20 Clock implementation based on server's geolocated IP timezone

v1.1.0(1y ago)04MITPHPPHP ^8.1

Since May 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/igor-popravka/ip-time-clock)[ Packagist](https://packagist.org/packages/igor-popravka/ip-time-clock)[ RSS](/packages/igor-popravka-ip-time-clock/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

IP Time Clock
=============

[](#ip-time-clock)

[![Latest Version](https://camo.githubusercontent.com/3ec4f8de70f27de79535a3b23e73bf54f8dbb51100f20df4b2035842e9fd73e2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f69676f722d706f707261766b612f69702d74696d652d636c6f636b2e737667)](https://github.com/igor-popravka/ip-time-clock/releases)[![PHP Version](https://camo.githubusercontent.com/7b2e5518db7ba55cf36a15db08a94b26471f33076a97985893f1c3849ac5d772/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f69676f722d706f707261766b612f69702d74696d652d636c6f636b2e737667)](https://www.php.net/)[![License](https://camo.githubusercontent.com/946f43108469804b956ff85adffbe9a07530be3ab8185efe61269ddd7f8fe4ed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f69676f722d706f707261766b612f69702d74696d652d636c6f636b2e737667)](LICENSE)

A Composer package implementing `\Psr\Clock\ClockInterface` that returns the accurate current server time based on its geolocation (determined by IP address).

---

Purpose
-------

[](#purpose)

This package provides the server's local time considering its timezone, which is automatically resolved via an external time API based on the server’s IP address. Useful when server time is set to UTC but localized time is needed.

---

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

[](#installation)

```
composer require igor-popravka/ip-time-clock
```

Usage
-----

[](#usage)

```
use IpTimeClock\Clock;
use IpTimeClock\Adapter\TimeIpIoAdapter;
use GuzzleHttp\Client;

// Initialize HTTP client (Guzzle)
$client = new Client();

// Optionally specify an IP address, or null to use server's IP
$ip = null;

// Create adapter
$adapter = new TimeIpIoAdapter($client);

// Create Clock instance
$clock = new Clock($adapter);

// Get current localized time
$currentTime = $clock->now();

echo $currentTime->format('Y-m-d H:i:sP');
```

### Configuration

[](#configuration)

- By default, the package uses **WorldTimeAPI** to determine the timezone from the server's IP address.
- You can specify a different IP address in the adapter constructor to get the time for a different location.
- To use another time API provider, implement your own adapter by implementing the `TimeApiAdapterInterface`.

### Testing

[](#testing)

The package includes unit tests that mock the time API adapter to verify the correct behavior of the `Clock` class.

To run tests:

```
vendor/bin/phpunit
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance46

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

410d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15196954?v=4)[igor-popravka](/maintainers/igor-popravka)[@igor-popravka](https://github.com/igor-popravka)

---

Top Contributors

[![igor-popravka](https://avatars.githubusercontent.com/u/15196954?v=4)](https://github.com/igor-popravka "igor-popravka (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/igor-popravka-ip-time-clock/health.svg)

```
[![Health](https://phpackages.com/badges/igor-popravka-ip-time-clock/health.svg)](https://phpackages.com/packages/igor-popravka-ip-time-clock)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[ecotone/ecotone

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

564576.7k53](/packages/ecotone-ecotone)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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