Download the PHP package ted7021/geo-clock without Composer
On this page you can find all versions of the php package ted7021/geo-clock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download ted7021/geo-clock
More information about ted7021/geo-clock
Files in ted7021/geo-clock
Download ted7021/geo-clock
More information about ted7021/geo-clock
Files in ted7021/geo-clock
Vendor ted7021
Package geo-clock
Short Description PHP clock based on external IP and timezone providers
License MIT
Package geo-clock
Short Description PHP clock based on external IP and timezone providers
License MIT
Please rate this library. Is it a good library?
Informations about the package geo-clock
GeoClock
GeoClock is a lightweight PHP library that implements PSR-20 ClockInterface and returns the current time based on your server’s external IP address.
It supports multiple external providers with automatic fallback if the first one fails.
Installation
Features
- Returns
DateTimeImmutable
based on actual timezone from IP. - Uses external providers like WorldTimeAPI, TimeAPI.io, ipgeolocation.io.
- Easily extendable: implement your own provider.
- PSR-20 compatible (
ClockInterface
).
Usage
Want to specify IP?
Advanced usage with custom providers
Providers
GeoClock includes the following providers:
Provider | Requires API key? |
---|---|
WorldTimeApiProvider |
❌ No |
TimeApiProvider |
❌ No |
IpGeolocationProvider |
✅ Yes |
Configuration: Timeout and Retries
Each provider supports configurable timeout and retries:
- Timeout: maximum number of seconds to wait for a response (default
5.0
seconds). - Retries: number of retry attempts on network errors (default
3
retries).
Example: Custom timeout and retries
Usage with API Key
Some providers require an API key, for example, ipgeolocation.io.
Example: Using IpGeolocationProvider
Testing
Requirements
- PHP 8.2+
- ext-curl
- Composer
All versions of geo-clock with dependencies
PHP Build Version
Package Version
The package ted7021/geo-clock contains the following files
Loading the files please wait ....