Whoami
A read-only snapshot of what the package detects about a request — IP, geo, device, bot classification, locale, referrer and tracking parameters — using the same detection as RecordVisitJob. Nothing is written: no visitor, session or event, no cookie.
Three ways to get it:
Visits::whoami()in PHPGET /visits/whoami— public JSON endpoint, usable by other services/visits/me— the dashboard page
In PHP
Section titled “In PHP”use Fomvasss\Visits\Facades\Visits;
$info = Visits::whoami(); // the current request$info = Visits::whoami($request); // another Request instance$info = Visits::whoami(ip: '8.8.8.8'); // geo for another IPVisits::whoami(?Request $request = null, ?string $ip = null): array$ip is passed through as is — validate it if it comes from user input. With visits.enabled = false whoami() returns [] and the endpoint is not registered.
JSON endpoint
Section titled “JSON endpoint”GET /visits/whoamiGET /visits/whoami?ip=8.8.8.8{ "ip": "8.8.8.8", "visitor_id": "7d0c3b1e-4f7e-4a8e-9a43-2a4f5b8c1d20", "user_agent": "Mozilla/5.0 ...", "bot": { "is_bot": false, "bot_name": null, "bot_category": null }, "device": { "device_type": "desktop", "device_family": null, "device_model": null, "platform": "Windows", "platform_version": "10", "browser": "Chrome", "browser_version": "128.0", "browser_engine": "Blink", "client_type": "browser" }, "geo": { "country_code": "US", "region": "California", "city": "Mountain View", "timezone": "America/Los_Angeles", "lat": "37.4056", "lng": "-122.0775", "country_name": "United States", "currency_code": null, "region_code": "CA", "zip_code": null, "postal_code": "94043", "metro_code": null, "area_code": null, "driver": "Stevebauman\\Location\\Drivers\\MaxMind" }, "locale": { "locale": "en", "browser_language": "en_US" }, "referrer": null, "tracking_params": { "utm": { "utm_source": "google" }, "extra": {} }}ip— the request’s IP, or?ip=when it is a valid IP address (an invalid value is ignored). Only geo andipchange with?ip=; device, locale and tracking parameters always describe the real requestvisitor_id— theX-Visitor-Idheader,visitor_idinput or cookie as sent, not validated;nullif none. Never generatedgeo—nullwhen the lookup found nothing;lat/lngare strings, absent withgeo.store_coordinates = false. Which fields are filled depends on the driverlocale— an object withlocale(the app locale) andbrowser_languagetracking_params—utmholds thecoreparameters keyed by column,extratheextra_keysandextra_patternmatches; both are{}when nothing matched
Configuration: whoami.enabled, whoami.path (default visits/whoami, independent of the dashboard path), whoami.middleware (['web']) and rate_limit.whoami (60,1, per IP). With visits.enabled = false the endpoint is not registered (since 0.13.6).