PHP code example of igor-popravka / ip-time-clock
1. Go to this page and download the library: Download igor-popravka/ip-time-clock library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
igor-popravka / ip-time-clock example snippets
use IpTimeClock\Clock;
use IpTimeClock\Adapter\TimeIpIoAdapter;
use GuzzleHttp\Client;
// Initialize HTTP client (Guzzle)
$client = new Client();
// Optionally specify an IP address, or null to use server's IP
$ip = null;
// Create adapter
$adapter = new TimeIpIoAdapter($client);
// Create Clock instance
$clock = new Clock($adapter);
// Get current localized time
$currentTime = $clock->now();
echo $currentTime->format('Y-m-d H:i:sP');