Download the PHP package hexogen/timesync without Composer

On this page you can find all versions of the php package hexogen/timesync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package timesync

Timesync

Package Version Tests Code Coverage PHP Version

A simple and elegant time synchronization library for PHP that allows you to synchronize your application's clock with a remote time source based on IP geolocation.

Features

Installation

Install via Composer:

Requirements

Upgrade Guide for 0.3.0

Version 0.3.0 contains a breaking API change:

Before (0.2.x)

After (0.3.0)

You can also catch Hexogen\Timesync\TimesyncException to handle all library-specific failures with one catch block.

Quick Start

Usage

Basic Clock Usage

The Clock class provides a synchronized time based on a reference timestamp:

Explicit IP Lookup with IPGeolocationClient

Use IPGeolocationClient when you already know which IPv4 address you want to resolve:

Automatic Server IP Detection with SyncService

Use SyncService when you want the library to detect the current server IP for you:

You can still override the detected IP explicitly:

Custom IP Detection

Implement your own IP detector:

API Reference

Clock

Implements Psr\Clock\ClockInterface

IPGeolocationClient

Implements SyncClientInterface

Throws InvalidIpAddressException, GeolocationServiceException, and ClientExceptionInterface.

SyncService

Implements SyncServiceInterface

Throws InvalidIpAddressException, GeolocationServiceException, ServerIpDetectionException, and ClientExceptionInterface.

IpifyIPDetector

Implements ServerIPDetectorInterface

Throws ServerIpDetectionException and ClientExceptionInterface.

Exception Types

Configuration

Get an ipgeolocation.io API Key

  1. Sign up at ipgeolocation.io
  2. Get your API key from the dashboard
  3. Pass it to IPGeolocationClient

Time Zones

The library automatically uses the timezone returned by the geolocation API. You can also manually specify a timezone when creating a Clock:

Testing

Run the test suite:

Run tests with coverage:

Check code style:

Fix code style:

Code Quality

This library follows:

Architecture

How It Works

  1. Optional IP Detection: SyncService fetches the current server IP when you do not provide one
  2. Geolocation: IPGeolocationClient queries the ipgeolocation.io API with an IPv4 address
  3. Time Extraction: The API returns the current time and timezone for that IP's location
  4. Clock Creation: A Clock instance stores the time delta and timezone
  5. Synchronized Time: The clock provides synchronized time adjusted for the delta

Error Handling

All library-specific exceptions implement Hexogen\Timesync\TimesyncException.

Performance

Examples

Laravel Integration

Symfony Integration

Contributing

Contributions are welcome. Feel free to submit a Pull Request.

Development Setup

License

This library is licensed under the MIT License. See LICENSE for details.

Credits

Changelog

0.3.0 (2026-03-11)

0.2.0 (2026-03-11)

0.1.1 (2026-03-10)

0.1.0 (2026-03-09)

Support

Related Projects


All versions of timesync with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
psr/clock Version ^1.0
psr/http-client Version ^1.0
psr/http-message Version ^2.0
nyholm/psr7 Version ^1.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hexogen/timesync contains the following files

Loading the files please wait ...