From 9664fc9544550f5b605b3d26dbe32df672d0f1eb Mon Sep 17 00:00:00 2001 From: Peter Gribanov Date: Mon, 12 Jul 2021 18:57:31 +0300 Subject: [PATCH] optimize docs for get GeoIP data in client locale --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 05609de..e4c57c8 100644 --- a/README.md +++ b/README.md @@ -218,11 +218,13 @@ class GeoIPController { public function index(Request $request, ReaderFactory $factory): Response { - $locale = $request->getLocale(); - $ip = $request->getClientIp(); + $client_locale = $request->getLocale(); + $client_ip = $request->getClientIp(); + $database_name = 'default'; + $fallback_locale = 'en'; - $reader = $factory->create('default', [$locale, 'en' /* fallback */]); - $record = $reader->city($ip); + $reader = $factory->create($database_name, [$client_locale, $fallback_locale]); + $record = $reader->city($client_ip); return new Response(sprintf('You are from %s?', $record->country->name)); }