Download the PHP package dmkravchuk/ip-clock without Composer
On this page you can find all versions of the php package dmkravchuk/ip-clock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download dmkravchuk/ip-clock
More information about dmkravchuk/ip-clock
Files in dmkravchuk/ip-clock
Download dmkravchuk/ip-clock
More information about dmkravchuk/ip-clock
Files in dmkravchuk/ip-clock
Vendor dmkravchuk
Package ip-clock
Short Description Resolves accurate server time and timezone via external IP lookup
License MIT
Package ip-clock
Short Description Resolves accurate server time and timezone via external IP lookup
License MIT
Please rate this library. Is it a good library?
Informations about the package ip-clock
dmkravchuk/ip-clock
A PSR-20 compliant Composer package that returns the correct server time and timezone based on the server's external IP address.
Requirements
- PHP ^8.2
- Composer
Installation
Via Packagist
Via VCS (without Packagist)
Add to your composer.json:
Then run:
Configuration
One of the time providers — ipgeolocation.io — requires a free API key.
- Create a free account at https://ipgeolocation.io
- Check the Dashboard the API KEY section
- Copy your API key
- Set it as an environment variable in
.envfile:
The package works without this key — ipgeolocation.io will simply be skipped if the key is not set.
Usage
Basic usage (auto-detect server IP)
With explicit IP address
With custom PSR-3 logger
PSR-20 compatibility
How it works
- Resolves the server's external IP via ipify.org
- Determines the timezone using a chain of time providers:
- Primary: timeapi.io — free, no API key required
- Fallback #1: worldtimeapi.org — free, no API key required
- Fallback #2: ipgeolocation.io — free API key required
- If all providers fail — returns current time in UTC
Running tests
License
MIT
All versions of ip-clock with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
psr/clock Version ^1.0
psr/log Version ^3.0
guzzlehttp/guzzle Version ^7.0
psr/clock Version ^1.0
psr/log Version ^3.0
guzzlehttp/guzzle Version ^7.0
The package dmkravchuk/ip-clock contains the following files
Loading the files please wait ...