https://github.com/filipsedivy/ntp
⏱ NTP reader
https://github.com/filipsedivy/ntp
ntp-client ntp-protocol php-reader
Last synced: about 1 year ago
JSON representation
⏱ NTP reader
- Host: GitHub
- URL: https://github.com/filipsedivy/ntp
- Owner: filipsedivy
- Created: 2018-05-06T21:20:06.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-23T23:43:36.000Z (almost 8 years ago)
- Last Synced: 2025-02-15T03:14:59.530Z (over 1 year ago)
- Topics: ntp-client, ntp-protocol, php-reader
- Language: PHP
- Homepage:
- Size: 58.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

[](https://travis-ci.org/filipsedivy/NTP)
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](https://github.com/briannesbitt/Carbon) for processing time
Installation
------------
The recommended way to is via [Composer](https://packagist.org/packages/filipsedivy/ntp):
```
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
-----
```php
$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(...);
```