Download the PHP package ivan-berger/server-timezone without Composer
On this page you can find all versions of the php package ivan-berger/server-timezone. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download ivan-berger/server-timezone
More information about ivan-berger/server-timezone
Files in ivan-berger/server-timezone
Download ivan-berger/server-timezone
More information about ivan-berger/server-timezone
Files in ivan-berger/server-timezone
Vendor ivan-berger
Package server-timezone
Short Description Get server time based on IP timezone
License
Package server-timezone
Short Description Get server time based on IP timezone
License
Please rate this library. Is it a good library?
Informations about the package server-timezone
Server Time Zone
This is a test project to retrieve the server's current time based on the provided IP address.
Description
The project includes a ServerTimeZone class that provides functionality to get the current server time using the IP address. It uses an external time API to fetch the current time and timezone information.
Installation
-
Clone the repository:
-
Navigate to the project directory:
- Install the dependencies using Composer:
Usage
To get the current server time based on the provided IP address, you can use the ServerTimeZone class:
use IvanBerger\ServerTimeZone\IPProvider;
use IvanBerger\ServerTimeZone\TimeServiceException;
use IvanBerger\ServerTimeZone\ServerTimeZone;
try {
$ipProvider = new IPProvider();
$ip = $ipProvider->detectIP();
echo 'Current IP detected: ' . $ip . PHP_EOL;
$serverTime = new ServerTimeZone($ip);
$cdt = $serverTime->getCurrentDateTime();
echo 'Current server time detected: ' . $cdt->format('Y-m-d H:i:s P');
} catch (TimeServiceException $e) {
echo 'Error: '.$e->getMessage();
}All versions of server-timezone with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.4
ext-curl Version *
ext-curl Version *
The package ivan-berger/server-timezone contains the following files
Loading the files please wait ...