NTP reader

Maintainers

Package info

github.com/filipsedivy/NTP

Issues

pkg:composer/filipsedivy/ntp

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

0.2 2018-08-23 23:42 UTC

This package is auto-updated.

Last update: 2026-02-27 18:37:02 UTC


README

NTP reader

Build Status

Introduction

The NTP reader is a class for reading data from the NTP server over the UDP / TCP port. The class allows:

  • read data from the NTP server
  • transfer output data to the Carbon library for processing time

Installation

The recommended way to is via Composer:

composer require filipsedivy/ntp

It requires PHP version 7.1 and supports PHP up to 7.2.

Tests

To run the tests, you must run this command via Composer

composer test

Usage

$socket = FilipSedivy\NTP\Socket::create('europe.pool.ntp.org');
$datetime = FilipSedivy\NTP\Client::getDateTime($socket);

// Carbon library
echo $datetime->toDateTimeString();

// Alternatively DateTime functions
echo $datetime->format(...);