PHP code example of devrabiul / laravel-geo-genius
1. Go to this page and download the library: Download devrabiul/laravel-geo-genius 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/ */
use Devrabiul\LaravelGeoGenius\Services\GeoLocationService;
$geo = new GeoLocationService();
$ip = $geo->getClientIp();
$locationData = $geo->locateVisitor();
use function Devrabiul\LaravelGeoGenius\geniusTrans;
use function Devrabiul\LaravelGeoGenius\geniusTranslateNumber;
echo geniusTrans('welcome_message');
echo geniusTranslateNumber(12345); // Bengali digits if locale is 'bn'
'translate' => [
'auto_translate' => true,
],
use Illuminate\Support\Facades\Route;
Route::get('/change-lang', function () {
// Change current user language to Bengali
laravelGeoGenius()->language()->changeUserLanguage('bn');
// Continue your logic
return redirect()->back();
});
use Devrabiul\LaravelGeoGenius\Services\TimezoneService;
$tz = new TimezoneService();
// Detect user's timezone
$timezone = $tz->getUserTimezone();
// Convert UTC datetime to user timezone
echo $tz->convertToUserTimezone('2025-09-13 15:00:00');