filipsedivy / ntp
NTP reader
0.2
2018-08-23 23:42 UTC
Requires
- php: >=7.1
- clue/socket-raw: v1.2.0
- danielstjules/stringy: 3.1.0
- moontoast/math: 1.1.2
- nesbot/carbon: 1.27.0
Requires (Dev)
- nette/tester: ^2.0
- phpstan/phpstan: ^0.10.3
This package is auto-updated.
Last update: 2024-10-27 15:44:01 UTC
README
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(...);